const { literal } = require('brigadier-commands') module.exports = { register (dispatcher) { const node = dispatcher.register( literal('randomteleport') .executes(this.randomTeleportCommand) ) dispatcher.register(literal('rtp').executes(this.randomTeleportCommand).redirect(node)) node.description = 'Teleports the sender to a random location' node.permissionLevel = 0 }, randomTeleportCommand (context) { const source = context.source const bot = source.bot const player = source.getPlayerOrThrow() bot.core.run(`tp ${player.uuid} ${randomInt(-30000000, 30000000)} 256 ${randomInt(-30000000, 30000000)}`) } } function randomInt (min, max) { return Math.floor((Math.random() * (max - min)) + min) }