Change minimum version to 1.13 and make it configurable
This commit is contained in:
parent
d612c085f0
commit
cfb19faee6
3 changed files with 17 additions and 2 deletions
|
@ -7,7 +7,7 @@ owobot is a Minecraft bot originally designed for [Kaboom](https://kaboom.pw/) a
|
||||||
- a command core, to run commands quickly
|
- a command core, to run commands quickly
|
||||||
- a hashing system, to enable trusted users to securely run certain commands in chat
|
- a hashing system, to enable trusted users to securely run certain commands in chat
|
||||||
|
|
||||||
It supports all Minecraft versions from 1.9 to 1.20.4 that are supported by node-minecraft-protocol.
|
It supports all Minecraft versions from 1.13 to 1.20.4 that are supported by node-minecraft-protocol.
|
||||||
|
|
||||||
If you are not sure if this code is safe to run, you can read through every line of code. You can also see the commit history by clicking on the (n) commits button, to make sure nobody has added any exploits or introduced vulnerabilities to the code.
|
If you are not sure if this code is safe to run, you can read through every line of code. You can also see the commit history by clicking on the (n) commits button, to make sure nobody has added any exploits or introduced vulnerabilities to the code.
|
||||||
|
|
||||||
|
|
14
index.js
14
index.js
|
@ -16,6 +16,9 @@ const generateUser = require('./util/usergen.js')
|
||||||
const EventEmitter = require('node:events')
|
const EventEmitter = require('node:events')
|
||||||
const settings = require('./settings.json')
|
const settings = require('./settings.json')
|
||||||
const secret = require('./secret.json')
|
const secret = require('./secret.json')
|
||||||
|
const version = require('./version.json')
|
||||||
|
const protover = require('./util/getProtocolVersion.js')
|
||||||
|
const mcd = require("minecraft-data")
|
||||||
module.exports.bots = []
|
module.exports.bots = []
|
||||||
|
|
||||||
const botplug = []
|
const botplug = []
|
||||||
|
@ -39,6 +42,8 @@ const loadplug = (botno) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let bypassWarningShown = false;
|
||||||
|
|
||||||
const createBot = function createBot (host, oldId) {
|
const createBot = function createBot (host, oldId) {
|
||||||
if (host.options.disabled) {
|
if (host.options.disabled) {
|
||||||
return
|
return
|
||||||
|
@ -48,6 +53,15 @@ const createBot = function createBot (host, oldId) {
|
||||||
port: host.port ? host.port : 25565,
|
port: host.port ? host.port : 25565,
|
||||||
version: host.version ? host.version : settings.version_mc
|
version: host.version ? host.version : settings.version_mc
|
||||||
}
|
}
|
||||||
|
if(protover(options.version) < version.minimumMcVersion) {
|
||||||
|
if(!settings.bypassVersionRequirement){
|
||||||
|
console.error(`[error] ${version.botName} does not support Minecraft versions below ${version.minimumMcVersion} (${mcd.postNettyVersionsByProtocolVersion.pc[version.minimumMcVersion][0].minecraftVersion})`)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
if(!bypassWarningShown) console.warn(`[warning] You have disabled the version requirement, allowing the bot to join on old servers. These versions are unsupported and may break at any time. Any issues on such versions will not be fixed.`)
|
||||||
|
bypassWarningShown = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (host.options.online) {
|
if (host.options.online) {
|
||||||
options.username = secret.onlineEmail
|
options.username = secret.onlineEmail
|
||||||
options.password = secret.onlinePass
|
options.password = secret.onlinePass
|
||||||
|
|
|
@ -3,5 +3,6 @@
|
||||||
"botVersion": "11.0.0-alpha.2",
|
"botVersion": "11.0.0-alpha.2",
|
||||||
"botAuthor": "uwu1104090889",
|
"botAuthor": "uwu1104090889",
|
||||||
"isPreRelease": true,
|
"isPreRelease": true,
|
||||||
"sourceURL": "https://code.chipmunk.land/7cc5c4f330d47060/owobot"
|
"sourceURL": "https://code.chipmunk.land/7cc5c4f330d47060/owobot",
|
||||||
|
"minimumMcVersion": 393
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue