From 97c66474f75f96b2201523b9767d4b37da808265 Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Fri, 14 Oct 2022 12:11:06 +0700 Subject: [PATCH] don't run commands when sender is undefined --- commands/rtp.js | 2 +- plugins/commands.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/commands/rtp.js b/commands/rtp.js index 469ed0f..0b71e44 100644 --- a/commands/rtp.js +++ b/commands/rtp.js @@ -9,6 +9,6 @@ module.exports = { execute: function(bot, username, usernameraw, sender, prefix, args) { const rtppos = `${between(20000000, 500000)} 100 ${between(20000000, 500000)}`; bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Teleporting ', color: 'white'}, {text: username, color: 'aqua'}, {text: ' to ', color: 'white'}, {text: rtppos, color: 'green'}, {text: '...', color: 'white'}])); - bot.core.run(`minecraft:execute unless entity @s[name= run ] run tp ${username} ${rtppos}`); + bot.core.run(`essentials:teleport ${sender} ${rtppos}`); }, }; diff --git a/plugins/commands.js b/plugins/commands.js index 81b6c46..37f0251 100644 --- a/plugins/commands.js +++ b/plugins/commands.js @@ -50,6 +50,7 @@ function inject(bot, dcclient) { try { const usernameraw = usernamee.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, ''); const sender = bot.options.host === 'sus.shhnowisnottheti.me' && senderr !== '00000000-0000-0000-0000-000000000000' ? senderr : bot.playersAddedPlayers[usernameraw]; + if (!sender) return; const username = bot.getplayerusername[sender]; const message = messagee.replace(/§r/g /* /§[a-f0-9rlonmk]/g */, '')/* .replace(/§/g, '')*/; bot.command_handler.run(username, usernameraw, message, sender);