refactors

This commit is contained in:
Chipmunk 2024-02-29 22:58:11 -05:00
parent 26614f7256
commit db871fa291
8 changed files with 16 additions and 19 deletions

11
bot.js
View file

@ -42,15 +42,10 @@ function createBot (options = {}) {
bot.plugins = plugins
bot.loadPlugin = loadPlugin
// add fards
// properties
bot.host = options.host
bot.port = options.port
/* bot._client.on('set_protocol', (packet) => {
bot.host = packet.serverHost
bot.port = packet.serverPort
}) */
// bot.username = () => bot._client.username
// bot.uuid = () => bot._client.uuid
bot.prefix = options.prefix
bot.brand = options.brand
bot.colors = options.colors
@ -81,6 +76,8 @@ function createBot (options = {}) {
bot.loggedIn = false
bot._client.on('login', () => {
bot.loggedIn = true
bot.username = bot._client.username
bot.uuid = bot._client.uuid
bot.emit('login')
})

View file

@ -7,7 +7,7 @@ const enabled = true
const permLevel = 0
function execute (bot, cmd, player, args, handler) {
bot.core.run(`essentials:sudo ${bot._client.uuid} c:${args.join(' ')}`)
bot.core.run(`essentials:sudo ${bot.uuid} c:${args.join(' ')}`)
}
module.exports = { name, description, usages, aliases, enabled, execute, permLevel }

File diff suppressed because one or more lines are too long

View file

@ -13,24 +13,24 @@ function inject (bot) {
switch (command) {
case 'icu':
case 'icontrolu:icu':
if (args[0] === 'control' && (bot._client.username.startsWith(args[1]) || args[1] === bot._client.uuid)) { bot.core.run(`essentials:sudo ${player.UUID} icontrolu:icu stop`) }
if (args[0] === 'control' && (bot.username.startsWith(args[1]) || args[1] === bot.uuid)) { bot.core.run(`essentials:sudo ${player.uuid} icontrolu:icu stop`) }
}
})
bot.on('chat', (message) => {
if (/\u00a76Vanish for .*\u00a76: disabled/.test(message.raw)) {
bot.core.run(`sudo ${bot._client.uuid} essentials:vanish enable`)
bot.core.run(`sudo ${bot.uuid} essentials:vanish enable`)
} else if (/§6God mode§c disabled§6./.test(message.raw)) {
bot.core.run(`sudo ${bot._client.uuid} essentials:god enable`)
bot.core.run(`sudo ${bot.uuid} essentials:god enable`)
} else if (/§rSuccessfully disabled CommandSpy/.test(message.raw)) {
bot.core.run(`sudo ${bot._client.uuid} commandspy:commandspy on`)
bot.core.run(`sudo ${bot.uuid} commandspy:commandspy on`)
} else if (/§6Your nickname is now .*§6./.test(message.raw)) {
bot.core.run(`essentials:nick ${bot._client.uuid} off`)
bot.core.run(`essentials:nick ${bot.uuid} off`)
}
})
bot.on('player_added', (player) => {
if (player.uuid === bot._client.uuid && player.username !== bot._client.username) bot.core.run(`essentials:sudo ${bot._client.uuid} username ${bot._client.username}`)
if (player.uuid === bot.uuid && player.username !== bot.username) bot.core.run(`essentials:sudo ${bot.uuid} username ${bot.username}`)
})
bot.on('packet.game_state_change', (packet) => {

View file

@ -31,7 +31,7 @@ function inject (bot) {
}
})
setTimeout(() => {
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({ nbt: 'SelectedItem.tag.i', entity: bot._client.uuid }))
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({ nbt: 'SelectedItem.tag.i', entity: bot.uuid }))
}, 50)
}
})

View file

@ -5,7 +5,7 @@
function inject (bot) {
bot.getEntityPos = function getEntityPos (selector, callback) {
if (typeof callback !== 'function') throw new Error('the callback must be a function lol')
bot.exploits.execute(`run teleport ${bot._client.uuid} ${selector}`)
bot.exploits.execute(`run teleport ${bot.uuid} ${selector}`)
bot._client.once('position', callback)
setTimeout(() =>
bot._client.removeListener('position', callback)

View file

@ -6,7 +6,7 @@ function inject (bot) {
bot._client.on('player_info', (packet) => {
if (bot.kbwl.enabled && packet.action === 0) {
packet.data.forEach((player) => {
if (player.UUID !== bot._client.uuid && !bot.kbwl.players.includes(player.name)) { bot.exploits.titleKick(`@a[name="${player.name.replace(/"/, '\\"')}"]`) }
if (player.UUID !== bot.uuid && !bot.kbwl.players.includes(player.name)) { bot.exploits.titleKick(`@a[name="${player.name.replace(/"/, '\\"')}"]`) }
})
}
})

View file

@ -21,7 +21,7 @@ function inject (bot) {
bot.seen = seen
bot.on('player_added', player => {
if (player.uuid === bot._client.uuid) return
if (player.uuid === bot.uuid) return
seen[player.username] ??= {}
if (seen[player.username].first == null) {