diff --git a/index.js b/index.js index 20a9abe..6156c80 100644 --- a/index.js +++ b/index.js @@ -11,7 +11,7 @@ async function main () { return result; }; - function randomEscape(length) { + function randomEscape (length) { let result = ''; const characters = '\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f'; const charactersLength = characters.length; @@ -33,7 +33,8 @@ async function main () { var client = mc.createClient({ "host": process.argv[2].split(":")[0], "port": parseInt(process.argv[2].split(":")[1]), - "username": randomEscape(16), + // "username": randomEscape(16), + "username": "radium_bot_", "version": config.version }) @@ -151,6 +152,11 @@ async function main () { client.on("player_info", (packet) => { if (packet.action & 0x01) { + if (client.trusted.includes(packet.data[0].uuid)) { + client.trusted = client.trusted.filter((element) => element != packet.data[0].uuid) + } if (client.owner.includes(packet.data[0].uuid)) { + client.owner = client.owner.filter((element) => element != packet.data[0].uuid) + } client.tellraw("@a", [ { color: config.publicColor.replaceAll("&", ""), @@ -192,42 +198,44 @@ async function main () { sleep(200); client.chat("/commandspy:commandspy on"); client.bcraw(`${config.publicColor}Prefixes: ${config.trustedColor}${config.prefix.join(`&8, ${config.trustedColor}`)}`); - setInterval(() => { - for (var i in client.hitlist) { - for (var j of client.players.filter((elem) => elem == elem.match(new RegExp(client.hitlist[i])))) { - client.cmdCore.run(`minecraft:deop @a[name="${j}"]`); - } - } - }, 10) - - setInterval(() => { - for (var i in client.hitlist) { + try { + setInterval(() => { for (var i in client.hitlist) { for (var j of client.players.filter((elem) => elem == elem.match(new RegExp(client.hitlist[i])))) { - client.cmdCore.run(`minecraft:gamemode spectator @a[name="${j}"]`); + client.cmdCore.run(`minecraft:deop @a[name="${j}"]`); } } - } - }, 10) + }, 10) - - /* setInterval(() => { - if (client.doMuteFilter) { + setInterval(() => { + for (var i in client.hitlist) { + for (var i in client.hitlist) { + for (var j of client.players.filter((elem) => elem == elem.match(new RegExp(client.hitlist[i])))) { + client.cmdCore.run(`minecraft:gamemode spectator @a[name="${j}"]`); + } + } + } + }, 10) + + + /* setInterval(() => { + if (client.doMuteFilter) { + for (var i in client.hitlist) { + for (var j of client.players.filter((elem) => elem == elem.match(new RegExp(client.hitlist[i])))) { + client.cmdCore.run(`essentials:mute ${j.replaceAll(" ", "?")} 10y Blacklisted by RadiumBot`); + } + } + } + }, 1500) */ + + setInterval(() => { for (var i in client.hitlist) { for (var j of client.players.filter((elem) => elem == elem.match(new RegExp(client.hitlist[i])))) { - client.cmdCore.run(`essentials:mute ${j.replaceAll(" ", "?")} 10y Blacklisted by RadiumBot`); + client.kick(`@a[name="${j}"]`); } } - } - }, 1500) */ - - setInterval(() => { - for (var i in client.hitlist) { - for (var j of client.players.filter((elem) => elem == elem.match(new RegExp(client.hitlist[i])))) { - client.kick(`@a[name="${j}"]`); - } - } - }, 100) + }, 100) + } catch (err) {} }, 500) client.on("systemChat", function (packet) { @@ -270,9 +278,9 @@ async function main () { if (args[0] == "" + client.trustedHash + "" || client.trusted.includes(packet.sender)) { require(`./commands/${cmd}.js`).inject(client, packet); client.runCommand(args); - if (!client.trusted.includes(packet.sender)) { - createHash("trusted"); - } + } else + if (!client.trusted.includes(packet.sender)) { + createHash("trusted"); } else { client.cmdError("Invalid trusted hash"); } @@ -281,9 +289,9 @@ async function main () { if (args[0] == "" + client.ownerHash + "" || client.owner.includes(packet.sender)) { require(`./commands/${cmd}.js`).inject(client, packet); client.runCommand(args); - if (!client.owner.includes(packet.sender)) { - createHash("owner"); - } + } else + if (!client.owner.includes(packet.sender)) { + createHash("owner"); } else { client.cmdError("Invalid owner hash"); }