chomens-bot-js/plugins/eaglercrash.js

23 lines
699 B
JavaScript
Raw Normal View History

function inject (bot) {
let id = NaN
bot.eaglercrash = {
on () {
if (!isNaN(id)) throw new Error('Eaglercrash is currently enabled')
2022-12-26 06:35:11 -05:00
const command = 'minecraft:execute as @a at @s run playsound block.note_block.harp record @a ~ ~ ~ 100000000000000000000000000000000000000 1 0'
bot.cloop.add(
command,
0,
false
)
id = bot.cloop.list.findIndex((cloop) => cloop.command === command) // ig not the best way to find the eaglercrash cloop
},
off () {
if (isNaN(id) /* you can't use !id */) throw new Error('Eaglercrash is currently not enabled')
bot.cloop.remove(id)
id = NaN
}
}
}
module.exports = { inject }