Compare commits

..

No commits in common. "main" and "v12.0.0-alpha.1" have entirely different histories.

40 changed files with 261 additions and 692 deletions

3
.gitignore vendored
View file

@ -163,6 +163,3 @@ userPref/
UBotLogs/
botvXLogs/
logs/
# Exploits file
exploits.js

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024-2025 7cc5c4f330d47060
Copyright (c) 2024 7cc5c4f330d47060
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View file

@ -7,7 +7,11 @@ botv12 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.18 to 1.21.3 that are supported by node-minecraft-protocol - newer versions have bugs on Kaboom servers. It may work on other versions, however, support will not be provided for them.
It supports all Minecraft versions from 1.13 to 1.21.1 that are supported by node-minecraft-protocol. It may work on other versions, however, support will not be provided for them.
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 find any exploits, security issues, etc in the code, please send me an issue or pull request and I will try to respond to it as soon as possible.
## How to install?
@ -18,6 +22,12 @@ It supports all Minecraft versions from 1.18 to 1.21.3 that are supported by nod
5. Copy the reference configuration (`settings_example.js` in the root) to `settings.js`, and adjust the settings to fit your needs. The secrets are also contained in this file as well.
6. Run ./launch.sh (macOS, Linux, FreeBSD) or ./launch.cmd (Windows). This will start a bot launcher, which will restart the bot when the process closes. Alternatively, you can run `node index.js` to start the bot only once (it will still rejoin when kicked). If it displays an error saying `node` is not a command, please make sure Node.js is on your PATH.
## License
## Command list
| Name | Usage | Description |
|-|-|-|
| about | [serverlist \| servers \| server] | About the bot. May also show system information or a list of connected servers. |
| test | | Debug command for the chat parser |
This project is licensed under the MIT License. Using, modifying, and distributing this code is allowed, even for commercial purposes. If you make any copies of this bot, you MUST link back to this repository. See the License file for the full terms and conditions.

View file

@ -1,12 +1,3 @@
/*
If you are forking the bot, you must comply with the MIT License, which only requires
attribution. If you choose to remove or modify this command, you must find another way to comply
with the MIT License, such as adding a message on join or in another command.
You may also make your fork open source as well, and add a message in the readme.
Additionally, if you're forking a fork with a different license, such as GPL, make sure you
comply with any additional terms.
*/
import os from 'node:os'
import { execSync } from 'child_process'
import { getMessage, formatTime } from '../util/lang.js'
@ -15,9 +6,8 @@ import { readdirSync, readFileSync } from 'node:fs'
import botVersion from '../util/version.js'
import version from '../version.js'
import { bots } from '../index.js'
import settings from '../settings.js'
const aboutBot = c => {
const aboutBot = function (c) {
c.reply({
translate: getMessage(c.lang, 'command.about.author'),
color: c.colors.secondary,
@ -39,45 +29,10 @@ const aboutBot = c => {
})
}
c.reply({ text: '' })
if(settings.officialUbotRealFullVersionFreeTwoThousandTwentyOneSafeNoVirusWorkingGenerator){
c.reply({
text: getMessage(c.lang, 'command.about.license'),
color: c.colors.secondary
})
} else {
c.reply({
translate: getMessage(c.lang, 'command.about.fork'),
color: c.colors.secondary,
with: [
{
text: version.originalName,
color: c.colors.primary
},
{
text: version.originalAuthor,
color: c.colors.primary
},
{
text: version.originalRepo,
color: c.colors.primary,
clickEvent: {
action: 'open_url',
value: version.originalRepo
},
hoverEvent: {
action: 'show_text',
contents: {
text: getMessage(c.lang, 'command.about.sourceCode.openInBrowser')
},
value: { // Added twice for backwards compatibility
text: getMessage(c.lang, 'command.about.sourceCode.openInBrowser')
}
}
}
]
})
}
if(version.sourceURL){
c.reply({
translate: getMessage(c.lang, 'command.about.sourceCode'),
color: c.colors.secondary,
@ -101,7 +56,6 @@ const aboutBot = c => {
}
]
})
}
c.reply({ text: '' })
c.reply({
text: getMessage(c.lang, 'command.about.subcommands'),
@ -147,7 +101,7 @@ const os2 = function (o2, l) {
}
}
const aboutServer = c => {
const aboutServer = function (c) {
const displayInfo = function (name, infoFunc) {
let thisItem
try {
@ -271,7 +225,7 @@ const aboutServer = c => {
})
}
const displayServerList = c => {
const displayServerList = function (c) {
bots.forEach((item, i) => {
if (c.bot.id === i && c.bot.host.options.hideLocally) return
if (item.host.options && item.host.options.hidden && c.verify !== 2 && c.bot.id !== i) return
@ -314,7 +268,7 @@ const displayServerList = c => {
})
}
const execute = c => {
const execute = function (c) {
let subcmd
if (c.args.length >= 1) subcmd = c.args[0].toLowerCase()
if (subcmd === 'servers') subcmd = 'serverlist'

View file

@ -1,4 +1,4 @@
const execute = c => {
const execute = (c) => {
c.bot.ccq.push(c.args.join(' '))
}
const consoleIndex = true

View file

@ -1,5 +1,5 @@
import { getMessage } from '../util/lang.js'
const execute = c => {
const execute = (c) => {
let subcmd
if (c.args.length >= 1) subcmd = c.args.splice(0, 1)[0].toLowerCase()
switch (subcmd) {
@ -10,7 +10,6 @@ const execute = c => {
c.reply({
text: getMessage(c.lang, 'command.cloop.error.tooShort')
})
return
}
c.bot.addCloop(command, rate)
c.reply({
@ -30,13 +29,14 @@ const execute = c => {
break
}
case 'remove': {
const index = +c.args[0]
c.bot.removeCloop(c.args[0])
c.reply({
translate: getMessage(c.lang, 'command.cloop.success.remove'),
color: c.colors.secondary,
with: [
{
text: c.args[0],
text: index + '',
color: c.colors.primary
}
]

View file

@ -1,22 +1,10 @@
import * as index from '../index.js' // Not used in the code, but may be used by users of the command
import { getMessage } from '../util/lang.js'
import { inspect } from 'node:util'
import settings from '../settings.js'
import chatlog from '../util/chatlog.js'
const execute = c => {
const payload = c.args.join(' ')
if (!settings.disableLogging && !settings.disableEvalLogging) chatlog('eval', `${c.host}:${c.port} ${c.username} (${c.uuid}) Payload: ${payload}`)
let result
try {
result = inspect(eval(payload))
if (!settings.disableLogging && !settings.disableEvalLogging) chatlog('eval', `${c.host}:${c.port} ${c.username} (${c.uuid}) Result: ${result}`)
} catch (e) {
result = inspect(e)
if (!settings.disableLogging && !settings.disableEvalLogging) chatlog('eval', `${c.host}:${c.port} ${c.username} (${c.uuid}) Error: ${inspect(e)}`)
}
const execute = (c) => {
const item = eval(c.args.join(' '))
if (c.type === 'console') {
console.log(result)
console.log(item)
} else {
c.reply({
translate: '%s: %s',
@ -27,11 +15,11 @@ const execute = c => {
color: c.colors.secondary
},
{
text: result + '',
text: item + '',
color: c.colors.primary,
clickEvent: {
action: 'copy_to_clipboard',
value: result + ''
value: item + ''
},
hoverEvent: {
action: 'show_text',

View file

@ -1,106 +0,0 @@
import { getMessage } from '../util/lang.js'
const execute = c => {
let subcmd
if (c.args.length >= 1) subcmd = c.args.splice(0, 1)[0].toLowerCase()
console.log(subcmd)
console.log(c.args)
switch (subcmd) {
case 'add': {
const command = c.args.join(' ')
let playerName
let uuid
console.log(command)
if (!/[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}/.test(command)) {
playerName = command
uuid = c.bot.findUUID(playerName)
if (uuid == '00000000-0000-0000-0000-000000000000') {
c.reply({
text: getMessage(c.lang, 'command.filter.error.notFound')
})
return
}
} else {
playerName = c.bot.findRealNameFromUUID(command)
uuid = command
}
if (!c.bot.isFiltered(command)) {
playerName = c.bot.findRealNameFromUUID(command)
c.bot.addFilter(uuid, playerName)
} else {
c.reply({
text: getMessage(c.lang, 'command.filter.error.filtered')
})
return
}
c.reply({
translate: getMessage(c.lang, 'command.filter.success.add'),
color: c.colors.secondary,
with: [
{
text: command,
color: c.colors.primary
},
{
text: playerName,
color: c.colors.primary
}
]
})
break
}
case 'remove': {
c.bot.removeFilter(c.args[0])
c.reply({
translate: getMessage(c.lang, 'command.filter.success.remove'),
color: c.colors.secondary,
with: [
{
text: c.args[0],
color: c.colors.primary
}
]
})
break
}
case 'list':
c.bot.filteredPlayers.forEach(item => {
c.reply({
translate: getMessage(c.lang, 'command.filter.list'),
color: c.colors.secondary,
with: [
{
text: item.username,
color: c.colors.primary
},
{
text: item.uuid,
color: c.colors.primary
}
]
})
})
break
case 'clear':
// c.bot.clearCloops()
c.reply({
text: getMessage(c.lang, 'Not implemented')
})
break
default:
c.reply({
translate: getMessage(c.lang, 'command.cloop.error.subcommand'),
color: c.colors.secondary,
with: [
{
text: `${c.prefix}help filter`,
color: c.colors.primary
}
]
})
}
}
const level = 0
const aliases = ['blacklist']
const consoleIndex = true
export { execute, level, consoleIndex }

View file

@ -7,7 +7,7 @@ const sortHelp = function sortHelp (c1, c2) {
return level1 - level2
}
const printHelp = c => {
const printHelp = (c) => {
const commandList = []
const permsN = getMessage(c.lang, 'command.help.permsNormal')
const permsT = getMessage(c.lang, 'command.help.permsTrusted')
@ -119,7 +119,7 @@ const printHelp = c => {
})
}
const printCmdHelp = c => {
const printCmdHelp = (c) => {
let cmd
if (c.args.length >= 1) cmd = c.args[0].toLowerCase()
if (!cmds[cmd] || (cmds[cmd].hidden && c.type !== 'console')) {
@ -224,7 +224,7 @@ const printCmdHelp = c => {
})
}
const execute = c => {
const execute = (c) => {
if (c.args.length > 0) {
printCmdHelp(c)
} else {

View file

@ -1,4 +1,4 @@
const execute = c => {
const execute = (c) => {
c.bot._client.end()
}
const consoleIndex = true

View file

@ -1,7 +1,7 @@
import { bots } from '../index.js'
import { getMessage } from '../util/lang.js'
const execute = c => {
const execute = (c) => {
let host = c.host
let port = c.port
if (c.bot.host.options && c.bot.host.options.hidden) {
@ -10,14 +10,12 @@ const execute = c => {
} else if (c.bot.host.options && c.bot.host.options.displayAsIPv6) {
host = `[${host}]`
}
let msg = c.args.join(' ').slice(0, 512)
msg = msg.replace(/:3/g, "")
const json = {
translate: '[%s] %s: %s',
with: [
{
text: c.bot.host.options?.name ?? "console",
/*hoverEvent: {
text: c.serverName,
hoverEvent: {
action: 'show_text',
value: {
translate: '%s: %s:%s',
@ -37,7 +35,7 @@ const execute = c => {
],
color: c.colors.secondary
}
},*/
},
color: c.colors.primary
},
{
@ -45,13 +43,13 @@ const execute = c => {
color: c.colors.primary
},
{
text: msg
text: c.args.join(' ').slice(0, 512)
}
],
color: c.colors.tertiary
}
bots.forEach(item => {
if (item.host.options.netmsgIncomingDisabled && c.type !== 'console') return
if (item.host.options && item.host.options.netmsgIncomingDisabled && c.type !== 'console') return
item.tellraw('@a', json)
})
}

View file

@ -1,5 +1,5 @@
const execute = c => {
c.bot.sc_tasks.cc.failed = true
const execute = (c) => {
c.bot.chat(c.bot.refillCoreCmd)
}
const consoleIndex = true
const aliases = ['refillcore', 'rc']

View file

@ -1,4 +1,4 @@
const execute = c => {
const execute = (c) => {
process.exit(0)
}
const aliases = ['reboot']

View file

@ -1,6 +1,6 @@
import settings from '../settings.js'
import version from '../version.js'
const execute = c => {
const execute = (c) => {
if (c.verify < 1) {
c.bot.tellraw('@a', {
translate: '%s %s: %s',

View file

@ -1,48 +0,0 @@
import { getMessage } from '../util/lang.js'
/*
Please note: I had this idea before I found out it was in other bots.
Please do not get mad at me because your bot also has this (or a similar) command.
*/
const execute = c => {
if (c.args[0] == 'set') {
const scale = Math.min(Math.max(+c.args[1], 0.0625), 16)
c.reply({
translate: getMessage(c.lang, 'command.scale.set'),
color: c.colors.secondary,
with: [
{
text: c.args[1],
color: c.colors.primary
}
]
})
c.bot.ccq.push(`attribute ${c.uuid} scale base set ${scale}`)
c.bot.ccq.push(`attribute ${c.uuid} gravity base set ${0.08 * scale}`)
c.bot.ccq.push(`attribute ${c.uuid} movement_speed base set ${0.1 * scale}`) // Very close to 0.1 normally, so we just round
c.bot.ccq.push(`attribute ${c.uuid} step_height base set ${0.6 * scale}`)
c.bot.ccq.push(`attribute ${c.uuid} jump_strength base set ${0.42 * scale}`) // Very close to 0.42 normally, so we just round
} else if (c.args[0] == 'reset') {
c.reply({
translate: getMessage(c.lang, 'command.scale.reset'),
color: c.colors.secondary
})
c.bot.ccq.push(`attribute ${c.uuid} scale base reset`)
c.bot.ccq.push(`attribute ${c.uuid} gravity base reset`)
c.bot.ccq.push(`attribute ${c.uuid} movement_speed base reset`)
c.bot.ccq.push(`attribute ${c.uuid} step_height base reset`)
c.bot.ccq.push(`attribute ${c.uuid} jump_strength base reset`)
} else {
c.reply({
translate: getMessage(c.lang, 'command.cloop.error.subcommand'),
color: c.colors.secondary,
with: [
{
text: `${c.prefix}help scale`,
color: c.colors.primary
}
]
})
}
}
const aliases = ['size'] // Other command names that will work the same (optional)
export { execute, aliases }

View file

@ -1,4 +1,4 @@
const execute = c => {
const execute = (c) => {
process.exit(1)
}
const aliases = ['exit']

View file

@ -1,4 +1,4 @@
const execute = c => {
const execute = (c) => {
// Blank template
/*
c.send(text, user?): Send text to all ("/tellraw @a")

View file

@ -1,5 +1,5 @@
import { getMessage } from '../util/lang.js'
const execute = c => {
const execute = (c) => {
const reply = function (name, item) {
return {
translate: '%s: %s',

View file

@ -1,6 +1,6 @@
import { getMessage } from '../util/lang.js'
const execute = c => {
const execute = function (c) {
let uuid
if (c.type === 'console') {
uuid = c.bot._client.uuid

View file

@ -1,6 +1,6 @@
import { getMessage } from '../util/lang.js'
const execute = c => {
const execute = (c) => {
const permsN = getMessage(c.lang, 'command.help.permsNormal')
const permsT = getMessage(c.lang, 'command.help.permsTrusted')
const permsO = getMessage(c.lang, 'command.help.permsOwner')

View file

@ -28,21 +28,12 @@ const createBot = function createBot (host, oldId) {
bot.host = host
bot.interval = {}
const options = {
bot._client = createClient({
host: host.host,
fakeHost: host.fakeHost,
port: host.port ?? 25565,
port: host.port ? host.port : 25565,
username: generateUser(host.options.legalName),
version: host.version ?? settings.version_mc
}
if (host.options.online) {
options.username = settings.onlineEmail
options.password = settings.onlinePass
options.auth = 'microsoft'
}
bot._client = createClient(options)
version: host.version ? host.version : settings.version_mc
})
bot.info = (msg) => {
console.log(`[${bot.id}] [info] ${msg}`)

View file

@ -18,12 +18,8 @@ export default {
'command.cloop.desc': 'Manage command loops',
'command.eval.usage': ' <code>',
'command.eval.desc': 'Run JavaScript code',
'command.filter.usage': ' (syntax not finalized)',
'command.filter.desc': 'Manage filtered players',
'command.help.usage': ' [cmd]',
'command.help.desc': 'Shows command help',
// 'command.kick.usage': ' (syntax not finalized)',
// 'command.kick.desc': 'Kick a player',
'command.logoff.usage': '',
'command.logoff.desc': 'Disconnect and reconnect the bot from a server',
'command.netmsg.usage': ' <message>',
@ -34,8 +30,6 @@ export default {
'command.say.desc': 'Sends a message to chat',
'command.restart.usage': '',
'command.restart.desc': 'Restart bot',
'command.scale.usage': ' set <size>|| reset',
'command.scale.desc': 'Change player size',
'command.stop.usage': '',
'command.stop.desc': 'Stop bot',
'command.template.usage': ' <required> [optional]',
@ -51,7 +45,6 @@ export default {
'command.about.preRelease': "This is a development version - there may be errors, and features may be changed or removed at any time. Please report any errors to the bot's developer.",
'command.about.sourceCode': 'Source code: %s',
'command.about.license': 'This bot is free and open-source software and is available under the terms of the MIT license.',
'command.about.fork': 'This bot is based on %s by %s, which is available at %s under the MIT license.',
'command.about.subcommands': "This command has subcommands to find out more about this bot - try running the commands \"servers\" for a list of Minecraft servers the bot is connected to, or \"serverinfo\" for technical specifications of the bot's server.",
'command.about.sourceCode.openInBrowser': 'Click to open the source code link in your default browser',
'command.cloop.error.tooShort': 'Command loops must have a rate above 20ms.',
@ -61,13 +54,6 @@ export default {
'command.cloop.success.clear': 'Cleared all command loops',
'command.cloop.list': '%s: Command: %s Rate: %s',
'command.eval.output': 'Output',
'command.filter.error.notUuid': 'You must pass a UUID to the command, not a username',
'command.filter.error.notFound': 'Could not find player information',
'command.filter.error.filtered': 'The player is already in the filter list.',
'command.filter.success.add': 'Filtered player %2$s',
'command.filter.success.remove': 'Unfiltered player %s',
'command.filter.success.clear': 'Cleared all command loops',
'command.filter.list': '%s (UUID: %s)',
'command.help.cmdList': 'Commands',
'command.help.commandInfo': '%s%s - %s',
'command.help.commandUsage': 'Usage - %s%s',
@ -85,8 +71,6 @@ export default {
'command.help.alias': 'Alias to %s',
'command.help.copyAlias': 'Click to copy this alias to your clipboard',
'command.netmsg.serverAddress': 'Server Address',
'command.scale.set': 'Set player size to %s',
'command.scale.reset': 'Reset player size',
'command.test.uuid': 'UUID',
'command.test.username': 'Username',
'command.test.nickname': 'Nickname',

View file

@ -1,15 +1,8 @@
@echo off
:botlaunch
node index.js
call :err_unwrap
timeout /nobreak /t 5 >NUL
goto botlaunch
:err_unwrap
set _err=%ERRORLEVEL%
if %_err% neq 0 (
exit %_err%
if %errorlevel%==1 (
exit
)
goto :eof
timeout /nobreak /t 5 > nul
goto botlaunch

View file

@ -1,7 +1,6 @@
#!/bin/sh
set -xe
while :; do
node index.js
sleep 5
#!/bin/bash
while [ true ];
do node index.js;
if [ $? -eq 1 ]; then exit; fi
sleep 6;
done

191
package-lock.json generated
View file

@ -1,18 +1,15 @@
{
"name": "botv12",
"version": "12.0.0-alpha.2",
"version": "12.0.0-alpha.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "botv12",
"version": "12.0.0-alpha.2",
"version": "12.0.0-alpha.1",
"license": "MIT",
"dependencies": {
"minecraft-protocol": "^1.54.0",
"prismarine-chat": "^1.10.1",
"prismarine-chunk": "^1.38.1",
"vec3": "^0.1.10"
"minecraft-protocol": "^1.49.0"
}
},
"node_modules/@azure/msal-common": {
@ -25,9 +22,9 @@
}
},
"node_modules/@azure/msal-node": {
"version": "2.16.2",
"resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-2.16.2.tgz",
"integrity": "sha512-An7l1hEr0w1HMMh1LU+rtDtqL7/jw74ORlc9Wnh06v7TU/xpG39/Zdr1ZJu3QpjUfKJ+E0/OXMW8DRSWTlh7qQ==",
"version": "2.16.0",
"resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-2.16.0.tgz",
"integrity": "sha512-oww0oJTOOvPKTVXqVyxfcFVjExQKYEkKR5KM0cTG3jnzt6u/MRMx8XaK49L/bxV35r9sCHQFjNlEShad9qGSYA==",
"license": "MIT",
"dependencies": {
"@azure/msal-common": "14.16.0",
@ -39,21 +36,12 @@
}
},
"node_modules/@types/node": {
"version": "22.13.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.4.tgz",
"integrity": "sha512-ywP2X0DYtX3y08eFVx5fNIw7/uIv8hYUKgXoK8oayJlLnKcRfEYCxWMVE1XagUdVtCJlZT1AU4LXEABW+L1Peg==",
"version": "22.9.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz",
"integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==",
"license": "MIT",
"dependencies": {
"undici-types": "~6.20.0"
}
},
"node_modules/@types/node-rsa": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@types/node-rsa/-/node-rsa-1.1.4.tgz",
"integrity": "sha512-dB0ECel6JpMnq5ULvpUTunx3yNm8e/dIkv8Zu9p2c8me70xIRUUG3q+qXRwcSf9rN3oqamv4116iHy90dJGRpA==",
"license": "MIT",
"dependencies": {
"@types/node": "*"
"undici-types": "~6.19.8"
}
},
"node_modules/@types/readable-stream": {
@ -200,9 +188,9 @@
"license": "MIT"
},
"node_modules/debug": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
"version": "4.3.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
@ -307,6 +295,15 @@
],
"license": "BSD-3-Clause"
},
"node_modules/jose": {
"version": "4.15.9",
"resolved": "https://registry.npmjs.org/jose/-/jose-4.15.9.tgz",
"integrity": "sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/panva"
}
},
"node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@ -360,7 +357,6 @@
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
"integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==",
"deprecated": "This package is deprecated. Use the optional chaining (?.) operator instead.",
"license": "MIT"
},
"node_modules/lodash.includes": {
@ -424,9 +420,9 @@
"license": "MIT"
},
"node_modules/minecraft-data": {
"version": "3.84.1",
"resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-3.84.1.tgz",
"integrity": "sha512-0yPsnu4rYjbokPgm6aMqhIm70fhsUUYFMEbbqrLG7QGLQDUy3lauuVlh3ctRxtPP6vX/ywLo1p5Uczz3Snnocg==",
"version": "3.78.0",
"resolved": "https://registry.npmjs.org/minecraft-data/-/minecraft-data-3.78.0.tgz",
"integrity": "sha512-Ssks8QD31lsoxqa7LySTqeP9romsfAbfsSGiUHiGMeqfxRi/PtOxGLyKD1BXB8V/tXLztFcbQYqzIhprDkPguw==",
"license": "MIT"
},
"node_modules/minecraft-folder-path": {
@ -436,12 +432,11 @@
"license": "MIT"
},
"node_modules/minecraft-protocol": {
"version": "1.54.0",
"resolved": "https://registry.npmjs.org/minecraft-protocol/-/minecraft-protocol-1.54.0.tgz",
"integrity": "sha512-v8pWRVhD9kyd/X52j/XESxrNxkmz1OHzSXAJkPLOQUUTENEqisJhu1c3abS7ZI+MAXHAEA/vaCb/Eh6XFxw0lA==",
"version": "1.50.0",
"resolved": "https://registry.npmjs.org/minecraft-protocol/-/minecraft-protocol-1.50.0.tgz",
"integrity": "sha512-GiZy8g4YG0iZEKifX6ulCyhVnTDGZ1gH0ouUdxjo6xkKwp4KOf+ptbBgZ8G5+WHCumrI91+v/JYU07uCvKdi0w==",
"license": "BSD-3-Clause",
"dependencies": {
"@types/node-rsa": "^1.1.4",
"@types/readable-stream": "^4.0.0",
"aes-js": "^3.1.2",
"buffer-equal": "^1.0.0",
@ -539,46 +534,24 @@
}
},
"node_modules/prismarine-auth": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/prismarine-auth/-/prismarine-auth-2.6.0.tgz",
"integrity": "sha512-9XXYtr6rnJ5EZ/pf63HJvvYPh3lSPe/AIZubwj2BXBQBEidoBR3P5MIm/1nukLwnF1xHiNpF5Y20gcHCdigMDg==",
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/prismarine-auth/-/prismarine-auth-2.5.0.tgz",
"integrity": "sha512-CRv/pL6d/T+4cdjWS223PXG+ygHbz40Kef04L59SLMT+axNdAQro23eZZhgiIIu6u7rlvJcZYlIY93gFNtKxXA==",
"license": "MIT",
"dependencies": {
"@azure/msal-node": "^2.0.2",
"@xboxreplay/xboxlive-auth": "^3.3.3",
"debug": "^4.3.3",
"jose": "^4.1.4",
"node-fetch": "^2.6.1",
"smart-buffer": "^4.1.0",
"uuid-1345": "^1.0.2"
}
},
"node_modules/prismarine-biome": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/prismarine-biome/-/prismarine-biome-1.3.0.tgz",
"integrity": "sha512-GY6nZxq93mTErT7jD7jt8YS1aPrOakbJHh39seYsJFXvueIOdHAmW16kYQVrTVMW5MlWLQVxV/EquRwOgr4MnQ==",
"license": "MIT",
"peerDependencies": {
"minecraft-data": "^3.0.0",
"prismarine-registry": "^1.1.0"
}
},
"node_modules/prismarine-block": {
"version": "1.21.0",
"resolved": "https://registry.npmjs.org/prismarine-block/-/prismarine-block-1.21.0.tgz",
"integrity": "sha512-Um7zRIMHKbtpHYq+bSibc+LgFPqhHCnJgy5DeUYGG1VPLptrHjgAwvzb9bztzpzz4auziZIX+325CCWSDjIv+Q==",
"license": "MIT",
"dependencies": {
"minecraft-data": "^3.38.0",
"prismarine-biome": "^1.1.0",
"prismarine-chat": "^1.5.0",
"prismarine-item": "^1.10.1",
"prismarine-nbt": "^2.0.0",
"prismarine-registry": "^1.1.0"
}
},
"node_modules/prismarine-chat": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/prismarine-chat/-/prismarine-chat-1.11.0.tgz",
"integrity": "sha512-VJT/MWYB3qoiznUhrgvSQh76YFpzpCZpY85kJKxHLbd3UVoM0wsfs43Eg8dOltiZG92wc5/DTMLlT07TEeoa9w==",
"version": "1.10.1",
"resolved": "https://registry.npmjs.org/prismarine-chat/-/prismarine-chat-1.10.1.tgz",
"integrity": "sha512-XukYcuueuhDxzEXG7r8BZyt6jOObrPPB4JESCgb+/XenB9nExoSHF8eTQWWj8faKPLqm1dRQaYwFJlNBlJZJUw==",
"license": "MIT",
"dependencies": {
"mojangson": "^2.0.1",
@ -586,42 +559,13 @@
"prismarine-registry": "^1.4.0"
}
},
"node_modules/prismarine-chunk": {
"version": "1.38.1",
"resolved": "https://registry.npmjs.org/prismarine-chunk/-/prismarine-chunk-1.38.1.tgz",
"integrity": "sha512-VL7BpYYzmZSKveiKNfwp/a50pPqEVy4rMdpOL6niyUsV/Nk4hRcqd2uo7GyKHlJci/mK3g7GOR8jsVX+hU07Aw==",
"license": "MIT",
"dependencies": {
"prismarine-biome": "^1.2.0",
"prismarine-block": "^1.14.1",
"prismarine-nbt": "^2.2.1",
"prismarine-registry": "^1.1.0",
"smart-buffer": "^4.1.0",
"uint4": "^0.1.2",
"vec3": "^0.1.3",
"xxhash-wasm": "^0.4.2"
},
"engines": {
"node": ">=14"
}
},
"node_modules/prismarine-item": {
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/prismarine-item/-/prismarine-item-1.16.0.tgz",
"integrity": "sha512-88Tz+/6HquYIsDuseae5G3IbqLeMews2L+ba2gX+p6K6soU9nuFhCfbwN56QuB7d/jZFcWrCYAPE5+UhwWh67w==",
"license": "MIT",
"dependencies": {
"prismarine-nbt": "^2.0.0",
"prismarine-registry": "^1.4.0"
}
},
"node_modules/prismarine-nbt": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/prismarine-nbt/-/prismarine-nbt-2.7.0.tgz",
"integrity": "sha512-Du9OLQAcCj3y29YtewOJbbV4ARaSUEJiTguw0PPQbPBy83f+eCyDRkyBpnXTi/KPyEpgYCzsjGzElevLpFoYGQ==",
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/prismarine-nbt/-/prismarine-nbt-2.6.0.tgz",
"integrity": "sha512-z65ijm6hVlYOmhg8IEzdYfUz1u3AOiQtzyTSAwD8NLBCr96ZUPtUH5o/6sGAoDaN+rkDe0DNBCiO7bvXXO1fkQ==",
"license": "MIT",
"dependencies": {
"protodef": "^1.18.0"
"protodef": "^1.9.0"
}
},
"node_modules/prismarine-realms": {
@ -635,13 +579,12 @@
}
},
"node_modules/prismarine-registry": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/prismarine-registry/-/prismarine-registry-1.11.0.tgz",
"integrity": "sha512-uTvWE+bILxYv4i5MrrlxPQ0KYWINv1DJ3P2570GLC8uCdByDiDLBFfVyk4BrqOZBlDBft9CnaJMeOsC1Ly1iXw==",
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/prismarine-registry/-/prismarine-registry-1.10.0.tgz",
"integrity": "sha512-6TYQiZHtsJ87HsB2E0yamCFp77ZyyLT16OmW5iXB5V30yCPflhHvR5TR2IqISmmiRc2093BkHfiIhsOZaMatmQ==",
"license": "MIT",
"dependencies": {
"minecraft-data": "^3.70.0",
"prismarine-block": "^1.17.1",
"prismarine-nbt": "^2.0.0"
}
},
@ -655,9 +598,9 @@
}
},
"node_modules/protodef": {
"version": "1.18.0",
"resolved": "https://registry.npmjs.org/protodef/-/protodef-1.18.0.tgz",
"integrity": "sha512-jO64lkzkh0dYc0AVWCU/GzCKwqhFFIz1kfEz0NBf0RUuRNcmvgKbopabJdfZ6W8NvALdySUXgEhvKDZPhdBwrg==",
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/protodef/-/protodef-1.17.0.tgz",
"integrity": "sha512-mnpNPV3xwu63u3NwZuXM1RCp979vjHxUGHzVrb6dxbvof5Fx+b8Rs0G0c3xtEuFDreGAMWS7VrlNkDUDBMsFWQ==",
"license": "MIT",
"dependencies": {
"lodash.get": "^4.4.2",
@ -670,9 +613,9 @@
}
},
"node_modules/protodef-validator": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/protodef-validator/-/protodef-validator-1.4.0.tgz",
"integrity": "sha512-2y2coBolqCEuk5Kc3QwO7ThR+/7TZiOit4FrpAgl+vFMvq8w76nDhh09z08e2NQOdrgPLsN2yzXsvRvtADgUZQ==",
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/protodef-validator/-/protodef-validator-1.3.1.tgz",
"integrity": "sha512-lZ5FWKZYR9xOjpMw1+EfZRfCjzNRQWPq+Dk+jki47Sikl2EeWEPnTfnJERwnU/EwFq6us+0zqHHzSsmLeYX+Lg==",
"license": "MIT",
"dependencies": {
"ajv": "^6.5.4"
@ -710,9 +653,9 @@
}
},
"node_modules/readable-stream": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
"integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz",
"integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==",
"license": "MIT",
"dependencies": {
"abort-controller": "^3.0.0",
@ -741,9 +684,9 @@
"license": "MIT"
},
"node_modules/semver": {
"version": "7.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz",
"integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==",
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
@ -797,16 +740,10 @@
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
"license": "MIT"
},
"node_modules/uint4": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/uint4/-/uint4-0.1.2.tgz",
"integrity": "sha512-lhEx78gdTwFWG+mt6cWAZD/R6qrIj0TTBeH5xwyuDJyswLNlGe+KVlUPQ6+mx5Ld332pS0AMUTo9hIly7YsWxQ==",
"license": "MIT"
},
"node_modules/undici-types": {
"version": "6.20.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
"version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
"license": "MIT"
},
"node_modules/uri-js": {
@ -836,12 +773,6 @@
"macaddress": "^0.5.1"
}
},
"node_modules/vec3": {
"version": "0.1.10",
"resolved": "https://registry.npmjs.org/vec3/-/vec3-0.1.10.tgz",
"integrity": "sha512-Sr1U3mYtMqCOonGd3LAN9iqy0qF6C+Gjil92awyK/i2OwiUo9bm7PnLgFpafymun50mOjnDcg4ToTgRssrlTcw==",
"license": "BSD"
},
"node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
@ -858,12 +789,6 @@
"webidl-conversions": "^3.0.0"
}
},
"node_modules/xxhash-wasm": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-0.4.2.tgz",
"integrity": "sha512-/eyHVRJQCirEkSZ1agRSCwriMhwlyUcFkXD5TPVSLP+IPzjsqMVzZwdoczLp1SoQU0R3dxz1RpIK+4YNQbCVOA==",
"license": "MIT"
},
"node_modules/yggdrasil": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/yggdrasil/-/yggdrasil-1.7.0.tgz",

View file

@ -1,6 +1,6 @@
{
"name": "botv12",
"version": "12.0.0-alpha.2",
"version": "12.0.0-alpha.1",
"description": "Minecraft bot for the Kaboom server",
"main": "index.js",
"type": "module",
@ -14,9 +14,6 @@
"author": "7cc5c4f330d47060",
"license": "MIT",
"dependencies": {
"minecraft-protocol": "^1.54.0",
"prismarine-chat": "^1.10.1",
"prismarine-chunk": "^1.38.1",
"vec3": "^0.1.10"
"minecraft-protocol": "^1.49.0"
}
}

View file

@ -1,60 +0,0 @@
import loader from 'prismarine-chunk'
import Vec3 from 'vec3'
const rd = 8
export default function load (b) {
const Chunk = loader(b._client.version)
b.chunks = {}
b._client.on('map_chunk', data => {
if (!b.chunks[data.x]) {
b.chunks[data.x] = []
}
const chunk = new Chunk()
chunk.load(data.chunkData)
b.chunks[data.x][data.z] = chunk
})
b._client.on('block_change', data => {
const chunkX = data.location.x >> 4
const chunkZ = data.location.z >> 4
const blockX = data.location.x & 15
const blockZ = data.location.z & 15
if (b.chunks[chunkX] && b.chunks[chunkX][chunkZ]) {
b.chunks[chunkX][chunkZ].setBlockStateId(new Vec3(blockX, data.location.y, blockZ), data.type)
}
})
b._client.on('multi_block_change', data => {
for (const record of data.records) {
const blockState = record >> 12
const blockX = record >> 8 & 15
const blockZ = record >> 4 & 15
const blockY = record & 15
if (b.chunks[data.chunkCoordinates.x] && b.chunks[data.chunkCoordinates.x][data.chunkCoordinates.z]) {
b.chunks[data.chunkCoordinates.x][data.chunkCoordinates.z].setBlockStateId(new Vec3(blockX, blockY + 16 * data.chunkCoordinates.y, blockZ), blockState)
}
}
})
b._client.on('position', data => {
if (!b.ccStarted) {
b.currentChunk = { x: data.x >> 4, z: data.z >> 4 }
b.pos = { x: data.x, y: data.y, z: data.z }
} else {
b.currentChunk = { x: data.x >> 4, z: data.z >> 4 }
b.pos = { x: data.x, y: data.y, z: data.z }
}
b._client.write('teleport_confirm', { teleportId: data.teleportId })
})
b.interval.unloadChunks = setInterval(() => {
for (const i in b.chunks) {
// X-values
if (i > b.currentChunk.x + rd || i < b.currentChunk.x - rd) {
delete b.chunks[i]
}
for (const z in b.chunks[i]) {
// Z-values
if (z > b.currentChunk.z + rd || z < b.currentChunk.z - rd) {
delete b.chunks[i][z]
}
}
}
}, 1500)
}

View file

@ -1,27 +1,32 @@
import uuidToInt from '../util/uuidtoint.js'
import plainParser from '../util/chatparse_plain.js'
import mcParser from '../util/chatparse_mc.js'
import Vec3 from 'vec3'
const cs = {
x: 4,
y: 6,
z: 4
}
export default function load (b) {
b.interval.commandFill = setInterval(() => { if (b.sc_tasks.cc) b.sc_tasks.cc.failed = 1 }, 150000)
b.ccq = []
b.blocknoX = 0
b.blocknoZ = 0
b.ccStarted = false
b.blocknoY = 0
b.pos = { x: 0, y: 0, z: 0 }
const refillPayload = `command_block`
b.refillCoreCmd = `/fill ~ 55 ~ ~${cs.x - 1} ${54 + cs.y} ~${cs.z - 1} command_block{CustomName:'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.region"}],"color":"#FFAAEE"}'}`
b.advanceccq = function () {
if (b.host.options.useChat) return
if (b.ccq[0] && b.ccq[0].length !== 0) {
const xstart = b.currentChunk.x << 4
const zstart = b.currentChunk.z << 4
b._client.write('update_command_block', {
command: '/',
location: {
x: xstart + b.blocknoX,
y: 55,
z: zstart + b.blocknoZ
x: b.commandPos.x + b.blocknoX,
y: b.commandPos.y + b.blocknoY,
z: b.commandPos.z + b.blocknoZ
},
mode: 2,
flags: 1
@ -29,22 +34,26 @@ export default function load (b) {
b._client.write('update_command_block', {
command: b.ccq[0].substr(0, 32767),
location: {
x: xstart + b.blocknoX,
y: 55,
z: zstart + b.blocknoZ
x: b.commandPos.x + b.blocknoX,
y: b.commandPos.y + b.blocknoY,
z: b.commandPos.z + b.blocknoZ
},
mode: 2,
flags: 5
})
b.blocknoX++
if (b.blocknoX === 16) {
b.blocknoZ++
if (b.blocknoX === cs.x) {
b.blocknoY++
b.blocknoX = 0
if (b.blocknoZ === 16) {
if (b.blocknoY === cs.y) {
b.blocknoZ++
b.blocknoY = 0
if (b.blocknoZ === cs.z) {
b.blocknoZ = 0
}
}
}
}
b.ccq.splice(0, 1)
}
@ -59,10 +68,8 @@ export default function load (b) {
})
if (!b.host.options.useChat) {
b.add_sc_task('cc', () => {
const xstart = b.currentChunk.x << 4
const zstart = b.currentChunk.z << 4
b.chat(`/fill ${xstart} 55 ${zstart} ${xstart + 15} 55 ${zstart + 15} ${refillPayload}`)
})
b.chat(b.refillCoreCmd)
}, true)
b.add_sc_task('cc_size', () => {
b.chat('/gamerule commandModificationBlockLimit 32768')
})
@ -75,12 +82,33 @@ export default function load (b) {
b.on('chat_unparsed', (data) => {
if (data.json.translate === 'commands.fill.failed' || (data.json.extra && data.json.extra[0] && data.json.extra[0].translate === 'commands.fill.failed') ||
data.json.translate === 'commands.fill.success' || (data.json.extra && data.json.extra[0] && data.json.extra[0].translate === 'commands.fill.success')) {
if (!b.ccStarted) {
b.emit('ccstart')
}
b.sc_tasks.cc.failed = 0
b.sc_tasks.cc_size.failed = 0
} else if (data.json.translate === 'commands.fill.toobig' || (data.json.extra && data.json.extra[0] && data.json.extra[0].translate === 'commands.fill.toobig')) {
b.sc_tasks.cc_size.failed = 1
}
})
b._client.on('position', function (a) {
if (!b.ccStarted) {
b.original_pos = { x: a.x, y: a.y, z: a.z }
b.pos = { x: a.x, y: a.y, z: a.z }
} else {
b.pos = { x: a.x, y: a.y, z: a.z }
if (a.x !== b.original_pos.x || a.z !== b.original_pos.z) {
b.original_pos = { x: a.x, y: a.y, z: a.z }
b.sc_tasks.cc.failed = 1
}
}
b.commandPos = {
x: Math.floor(a.x),
z: Math.floor(a.z),
y: 55
}
b._client.write('teleport_confirm', { teleportId: a.teleportId })
})
b.tellraw = (uuid, message) => {
let finalname = ''
@ -107,24 +135,4 @@ export default function load (b) {
b.ccq.push(`/${tellrawCommand} ${finalname} ${JSON.stringify(message)}`)
}
}
b.interval.coreCheck = setInterval(() => {
let cf = false
if (!b.currentChunk || !b.chunks[b.currentChunk.x] || !b.chunks[b.currentChunk.x][b.currentChunk.z]) return
const chunk = b.chunks[b.currentChunk.x][b.currentChunk.z]
for (let x = 0; x <= 15; x++) {
for (let z = 0; z <= 15; z++) {
const blockName = chunk.getBlock(new Vec3(x, 55, z)).name
if (blockName !== 'command_block' && blockName !== 'repeating_command_block' && blockName !== 'chain_command_block') {
cf = true
if (b.sc_tasks.cc) b.sc_tasks.cc.failed = true
break
}
}
if (cf) break
}
if (!cf && !b.ccStarted) {
b.emit('ccstart')
}
}, 500)
}

View file

@ -9,11 +9,11 @@ import { userInfo } from 'node:os'
const consoleBotStub = {
host: {
host: 'bot console ',
port: 25565
port: 3
},
tellraw: (_unused, data) => console.log(parse2(data))
}
const uuid = '01234567-89ab-cdef-0123-456789abcdef'
const uuid = '4d616465-6c69-6e65-2075-7775203a3300'
const user = userInfo().username // OS user the bot is running as
const nick = user
@ -23,38 +23,31 @@ const rl = createInterface({
prompt: '\x1b[0m> '
})
rl.on('line', (l) => {
const args = l.split(' ')
const cmdName = args[0].toLowerCase()
try {
const cmd = cmds[cmdName]
if (!cmd) {
rl.prompt(false)
return
}
if (cmd.consoleIndex) {
const index2 = args.splice(1, 1)[0]
if (cmds[l.split(' ')[0].toLowerCase()]) {
if (cmds[l.split(' ')[0].toLowerCase()].consoleIndex) {
const tmpcmd = l.split(' ')
const index2 = tmpcmd.splice(1, 1)[0]
if (index2 === '*') {
for (let i = 0; i < bots.length; i++) {
const context = new Command(uuid, user, nick, args.join(' '), 'console', 'console', 'console', '', bots[i])
context.verify = 2
cmd.execute(context)
const cmd = new Command(uuid, user, nick, tmpcmd.join(' '), 'console', 'console', 'console', '', bots[i])
cmd.verify = 2
cmds[l.split(' ')[0].toLowerCase()].execute(cmd)
}
} else {
const context = new Command(uuid, user, nick, args.join(' '), 'console', 'console', 'console', '', bots[+index2])
context.verify = 2
cmd.execute(context)
const cmd = new Command(uuid, user, nick, tmpcmd.join(' '), 'console', 'console', 'console', '', bots[+index2])
cmd.verify = 2
cmds[l.split(' ')[0].toLowerCase()].execute(cmd)
}
} else {
const context = new Command(uuid, user, nick, l, 'console', 'console', 'console', '', consoleBotStub)
context.verify = 2
cmd.execute(context)
const cmd = new Command(uuid, user, nick, l, 'console', 'console', 'console', '', consoleBotStub)
cmd.verify = 2
cmds[l.split(' ')[0].toLowerCase()].execute(cmd)
}
}
} catch (e) {
console.log(e)
}
rl.prompt(false)
})
rl.prompt()
@ -65,7 +58,6 @@ function consoleWrite (text) {
process.stdout.write(text + '\n')
rl.prompt(true)
}
export default function load (b) {
b.info = (msg) => {
consoleWrite(`[${b.id}] [info] ${msg}`)

View file

@ -1,49 +0,0 @@
import uuidToInt from '../util/uuidtoint.js'
export default function load (b) {
b.filteredPlayers = []
b.interval.deopFiltered = setInterval(() => {
b.filteredPlayers.forEach(item => {
if (b.players[item.uuid] && b.players[item.uuid].here) {
b.ccq.push(`/deop @a[nbt={UUID:[I;${uuidToInt(item.uuid)}]}]`)
b.ccq.push(`/gamemode spectator @a[nbt={UUID:[I;${uuidToInt(item.uuid)}]}]`)
}
})
}, 50)
b.addFilter = function (uuid, username) {
b.filteredPlayers.push({
username,
uuid
})
}
b.removeFilter = function (string) {
let index = -1
if (/[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}/.test(string)) { // Uuid code
b.filteredPlayers.forEach((item, index2) => {
if (item.uuid == string) {
console.log(index2)
index = index2
}
})
} else { // Uuid code
b.filteredPlayers.forEach((item, index2) => {
if (item.username == string) {
console.log(index2)
index = index2
}
})
}
if (index == -1) return
b.filteredPlayers.splice(index, 1)
}
b.isFiltered = function (string) {
let playerIsFiltered = false
b.filteredPlayers.forEach((item) => {
if (item.uuid == string) {
playerIsFiltered = true
}
})
return playerIsFiltered
}
}

View file

@ -3,14 +3,7 @@ import parseNBT from '../util/parseNBT.js'
export default function load (b) {
b.players = {}
b._client.on('player_remove', data => {
for (const item of data.players) {
if(!data.players[item]) continue;
b.players[item].here = false
b.emit('playerquit', item)
}
})
b._client.on('player_info', data => {
b._client.on('player_info', (data) => {
const buffer2 = {}
for (const player of data.data) {
let uuid
@ -35,7 +28,6 @@ export default function load (b) {
}
for (const uuid in buffer2) {
if (!b.players[uuid]) b.players[uuid] = { displayName: '', realName: '' }
b.players[uuid].here = true
let displayName = ''
let realName = ''
if (buffer2[uuid].displayName) {
@ -49,7 +41,7 @@ export default function load (b) {
b.emit('playerdata', uuid, displayName, realName)
}
})
b.findUUID = name => {
b.findUUID = (name) => {
for (const i in b.players) {
if (b.players[i].realName === name) {
return i
@ -57,7 +49,7 @@ export default function load (b) {
}
return '00000000-0000-0000-0000-000000000000'
}
b.findRealName = name => {
b.findRealName = (name) => {
for (const i in b.players) {
if (b.players[i].displayName === name) {
return b.players[i].realName
@ -65,14 +57,14 @@ export default function load (b) {
}
return '[[[[ no name ]]]]'
}
b.findRealNameFromUUID = uuid => {
b.findRealNameFromUUID = (uuid) => {
if (b.players[uuid]) {
return b.players[uuid].realName
} else {
return uuid
return '[[[[ no name ]]]]'
}
}
b.findDisplayName = uuid => {
b.findDisplayName = (uuid) => {
if (b.players[uuid]) {
const displayName = b.players[uuid].displayName.split(' ')
return displayName[displayName.length - 1]

View file

@ -27,7 +27,7 @@ export default function load (b) {
}
}
b.selfcareRun = Date.now()
}, 200)
}, 40)
})
b.add_sc_task = (name, failTask, startFailed) => {
b.sc_tasks[name] = new SCTask(failTask, startFailed)
@ -125,8 +125,7 @@ export default function load (b) {
}
})
b.on('plainchat', (msg) => {
if (msg === `You now have the tag: ${parseMc(b.adPrefix).replaceAll('§', '&')}` ||
msg === 'Something went wrong while saving the prefix. Please check console.') { // Fix the prefix issue
if (msg === `You now have the tag: ${parseMc(b.adPrefix).replaceAll('§', '&')}`) {
b.sc_tasks.playerlist_ads.failed = 0
}
})

View file

@ -189,18 +189,18 @@ export default function load (b) {
})
b.on('chat', (data) => {
b.messageCount++
if (Date.now() < b.chatDisabledUntil) return
if (b.messageCount >= 100) {
b.info(getMessage(settings.defaultLang, 'chat.antiSpamTriggered'))
b.chatDisabledUntil = Date.now() + 30000
return
}
const msgConsole = parseConsole(data.json)
const msgPlain = parsePlain(data.json)
if (settings.logJSONmessages) console.log(data.json)
if (msgPlain.endsWith('\n\n\n\n\nThe chat has been cleared')) return
if (msgPlain.startsWith('Command set: ')) return
b.messageCount++
if (b.messageCount >= 100) {
b.info(getMessage(settings.defaultLang, 'chat.antiSpamTriggered'))
b.chatDisabledUntil = Date.now() + 20000
return
}
b.emit('plainchat', msgPlain, data.type, data.subtype)
b.displayChat(data.type, data.subtype, `${msgConsole}\x1b[0m`)
})

View file

@ -2,7 +2,8 @@ export default {
terminalMode: 'blackTerminal_24bit', // Terminal mode. Most modern terminals support 24-bit color
version_mc: '1.21.1', // Minecraft version to connect with
defaultLang: 'en-US', // Default language
// Insert the trusted key (keyTrusted) and owner key (keyOwner) here. Both of these values should be strings, and they should not be identical. Do not tell anyone the keys unless you trust them, as they can be used to get admin access to the bot, and (in the case of the owner key) access to your computer.
keyTrusted: '3e9f13473eec8d64c3eabf6385e3f8585f0af39ed30a8db9a4c8d8bcfa35659d7d06a58b342bfd2db5e3cbb4003a81da8f9d25f7cce1ad26face8e2871c3b217', // Trusted key
keyOwner: '17d2c6c53b8919dc1ec22c42845018ac389824c4d73a68572b7fc57ff1442c6bbf9924d5ee5fa90cb23e384278d469c4e260208265b8ba2e2bc873045d5ed42e', // Owner key
colors: { // All colors the bot uses
primary: '#EECCFF', // Used for primary subjects (e.g. items in lists)
secondary: '#DD99FF', // Used for secondary subjects (e.g. list labels)

View file

@ -15,8 +15,8 @@ export default class Command {
this.colors = settings.colors
this.lang = settings.defaultLang
this.verify = 0
this.host = bot?.host.host
this.port = bot?.host.port
this.host = bot.host.host
this.port = bot.host.port
this.bot = bot
this.rewriteCommand = newCmd => {

View file

@ -7,12 +7,13 @@ export default function (cmd, uuid) {
const dateString = _dateString.slice(0, _dateString.length - 4)
const hashTrusted = `babyboom:${settings.keyTrusted}:${uuid}:${cmdWithoutHash}:${dateString}`
const hashOwner = `babyboom:${settings.keyOwner}:${uuid}:${cmdWithoutHash}:${dateString}`
const hashPart = cmd[cmd.length - 1]
const validhashT = createHash('sha256').update(hashTrusted).digest('hex')
const validhashO = createHash('sha256').update(hashOwner).digest('hex')
if (hashPart === validhashT) return 1
if (hashPart === validhashO) return 2
if (cmd[cmd.length - 1] === validhashT) {
return 1
}
if (cmd[cmd.length - 1] === validhashO) {
return 2
}
return 0
}

View file

@ -1,5 +1,5 @@
import MinecraftData from 'minecraft-data'
const _lang = MinecraftData('1.21.1').language
const _lang = MinecraftData('1.20.6').language
const lang = Object.create(null) // Without constructor function
for (const i in _lang) {
lang[i] = _lang[i]

View file

@ -1,16 +1,15 @@
const UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
const THRESHOLD = 1000 // KiB = 1024; KB = 1000
export default function memoryconvert (bytes) {
for (let i = 0; i < UNITS.length; i++) {
const last = i === (UNITS.length - 1)
const max = THRESHOLD ** (i + 1)
if (!last && bytes >= max) continue
const divisor = THRESHOLD ** i
const unit = UNITS[i]
const div = bytes / divisor
return `${+div.toFixed(2)} ${unit}`
if (bytes >= 1125899906842624) { // Petabytes
return `${Math.round(bytes / 1125899906842624 * 100) / 100} PB`
} else if (bytes >= 1099511627776) { // Terabytes
return `${Math.round(bytes / 1099511627776 * 100) / 100} TB`
} else if (bytes >= 1073741824) { // Gigabytes
return `${Math.round(bytes / 1073741824 * 100) / 100} GB`
} else if (bytes >= 1048576) { // Megabytes
return `${Math.round(bytes / 1048576 * 100) / 100} MB`
} else if (bytes >= 1024) { // Kilobytes
return `${Math.round(bytes / 1024 * 100) / 100} KB`
} else { // Bytes
return `${bytes} B`
}
}

View file

@ -28,12 +28,19 @@ const rsg = function (count) {
return output
}
const rsgLegal = function (count) {
return randomBytes(count).toString('hex')
let output = ''
if (Math.random() > 0.5) {
output += 'uwu_'
} else {
output += 'owo_'
}
output += randomBytes(count).toString('hex')
return output
}
export default function generateUser (legal) {
if (legal) {
return rsgLegal(8)
return rsgLegal(6)
} else {
return rsg(6 + Math.floor(Math.random() * 3))
}

View file

@ -1,10 +1,7 @@
export default {
botName: 'botv12 Dev', // Name of the bot
botVersion: '12.0.0-alpha.2', // Version of the bot. This is different from the one in package.json, which has to be updated seperately.
botAuthor: 'owo439895035', // The creator of the bot
isPreRelease: true, // If this version is a pre-release version. Used by the about command to show a warning if set to true.
sourceURL: 'https://code.chipmunk.land/7cc5c4f330d47060/botv12', // Source code repository URL. This is different from the one in package.json.
originalRepo: 'https://code.chipmunk.land/7cc5c4f330d47060/botv12',
originalName: 'botv12',
originalAuthor: 'owo439895035' //These three fields should only be changed in forks of forks, if the original fork is compliant with MIT
botName: 'botv12 Dev',
botVersion: '12.0.0-alpha.1',
botAuthor: 'owo439895035',
isPreRelease: true,
sourceURL: 'https://code.chipmunk.land/7cc5c4f330d47060/botv12'
}