Change minimum version to 1.13 and make it configurable

This commit is contained in:
7cc5c4f330d47060 2024-09-22 23:45:18 -04:00
parent d612c085f0
commit cfb19faee6
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
3 changed files with 17 additions and 2 deletions

View file

@ -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 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.

View file

@ -16,6 +16,9 @@ const generateUser = require('./util/usergen.js')
const EventEmitter = require('node:events')
const settings = require('./settings.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 = []
const botplug = []
@ -39,6 +42,8 @@ const loadplug = (botno) => {
})
}
let bypassWarningShown = false;
const createBot = function createBot (host, oldId) {
if (host.options.disabled) {
return
@ -48,6 +53,15 @@ const createBot = function createBot (host, oldId) {
port: host.port ? host.port : 25565,
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) {
options.username = secret.onlineEmail
options.password = secret.onlinePass

View file

@ -3,5 +3,6 @@
"botVersion": "11.0.0-alpha.2",
"botAuthor": "uwu1104090889",
"isPreRelease": true,
"sourceURL": "https://code.chipmunk.land/7cc5c4f330d47060/owobot"
"sourceURL": "https://code.chipmunk.land/7cc5c4f330d47060/owobot",
"minimumMcVersion": 393
}