diff --git a/commands/ayunsudo.js b/commands/ayunsudo.js index 0ed5558..d483154 100644 --- a/commands/ayunsudo.js +++ b/commands/ayunsudo.js @@ -5,8 +5,8 @@ module.exports = { description: 'Sudo everyone on Ayunboom!', trusted: 1, usage: ' ', - execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0] === bot.hash) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { + if (args[0] === hash) { bot.core.run(`essentials:sudo * ${args.slice(1).join(' ')}`); } else { throw new Error('Invalid hash'); diff --git a/commands/botuser.js b/commands/botuser.js index a949de7..6413a48 100644 --- a/commands/botuser.js +++ b/commands/botuser.js @@ -6,7 +6,7 @@ module.exports = { description: 'Shows the bot\'s username and UUID', usage: '', trusted: 0, - execute: function(bot) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { bot.tellraw('@a', [{text: 'The bot\'s username is: ', color: 'white'}, {text: `${bot.username}`, color: 'gold', clickEvent: {action: 'copy_to_clipboard', value: `${bot.username}`}, hoverEvent: {action: 'show_text', contents: [{text: 'Click here to copy the username to your clipboard', color: 'green'}]}}, {text: ' and the UUID is: '}, {text: `${bot.uuid}`, color: 'aqua', clickEvent: {action: 'copy_to_clipboard', value: `${bot.uuid}`}, hoverEvent: {action: 'show_text', contents: [{text: 'Click here to copy the UUID to your clipboard', color: 'green'}]}}]); }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) { diff --git a/commands/botvisibility.js b/commands/botvisibility.js index 576a5c8..ecda70e 100644 --- a/commands/botvisibility.js +++ b/commands/botvisibility.js @@ -6,8 +6,8 @@ module.exports = { description: 'Changes the bot\'s visibility', usage: ' ', trusted: 1, - execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0] === bot.hash) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { + if (args[0] === hash) { if (args[1] === 'true') { bot.visibility = true; bot.chat('/essentials:vanish disable'); diff --git a/commands/bruhify.js b/commands/bruhify.js index a23a6c1..d060ca9 100644 --- a/commands/bruhify.js +++ b/commands/bruhify.js @@ -6,7 +6,7 @@ module.exports = { description: 'RecycleBot bruhify but actionbar', usage: '', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { bot.bruhifyText = args.join(' '); }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) { diff --git a/commands/cb.js b/commands/cb.js index 029448e..f3c1073 100644 --- a/commands/cb.js +++ b/commands/cb.js @@ -5,7 +5,7 @@ module.exports = { description: 'Executes a command in the command core', usage: '', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { bot.core.run(args.join(' ')); }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) { diff --git a/commands/changelog.js b/commands/changelog.js index 028fae6..3998d40 100644 --- a/commands/changelog.js +++ b/commands/changelog.js @@ -7,7 +7,7 @@ module.exports = { description: 'Shows the bot\'s changelog', usage: '', trusted: 0, - execute: function(bot) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { bot.tellraw('@a', [{text: 'Changelogs:', color: 'green'}]); changelog.forEach((message, number) => { number += 1; diff --git a/commands/clearchat.js b/commands/clearchat.js index de0e4e3..eb12990 100644 --- a/commands/clearchat.js +++ b/commands/clearchat.js @@ -6,7 +6,7 @@ module.exports = { description: 'Clears the chat', usage: '[specific] ', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { if (args[0] === 'specific') { bot.tellraw(args[1], [{text: `${'\n'.repeat(100)}`, color: 'white'}, {text: `Your chat has been cleared by ${username}.`, color: 'dark_green'}]); return; diff --git a/commands/clearchatqueue.js b/commands/clearchatqueue.js index 5c67acd..ff256a0 100644 --- a/commands/clearchatqueue.js +++ b/commands/clearchatqueue.js @@ -4,7 +4,7 @@ module.exports = { alias: ['ccq'], usage: '', trusted: 0, - execute: function(bot) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { if (bot.queue[0]) { bot.queue = []; } diff --git a/commands/cloop.js b/commands/cloop.js index a08458d..5032e54 100644 --- a/commands/cloop.js +++ b/commands/cloop.js @@ -65,10 +65,10 @@ module.exports = { ' ', ], trusted: 1, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { if (!bot.cloops) bot.cloops = []; - if (args[0] === bot.hash) { + if (args[0] === hash) { if (args[1] === 'add' && args[3]) { if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval'); add(args.slice(3).join(' '), args[2], bot); diff --git a/commands/cowsay.js b/commands/cowsay.js index 82854e9..f4af9d0 100644 --- a/commands/cowsay.js +++ b/commands/cowsay.js @@ -7,7 +7,7 @@ module.exports = { description: 'Moo', usage: ' ', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { if (args[0]==='list') { const listed = Object.keys(cows); diff --git a/commands/crashserver.js b/commands/crashserver.js index 415a40a..972bc17 100644 --- a/commands/crashserver.js +++ b/commands/crashserver.js @@ -15,8 +15,8 @@ module.exports = { description: 'Crashes the server', usage: '', trusted: 1, - execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0] === bot.hash) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { + if (args[0] === hash) { crash(bot); } else { throw new Error('Invalid hash'); diff --git a/commands/creator.js b/commands/creator.js index 9272daf..bdbad43 100644 --- a/commands/creator.js +++ b/commands/creator.js @@ -6,7 +6,7 @@ module.exports = { description: 'Shows the bot\'s creator', usage: '', trusted: 0, - execute: function(bot) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { bot.tellraw('@a', [{text: 'ChomeNS Bot ', color: 'yellow'}, {text: 'was created by ', color: 'white'}, {text: 'chayapak', color: 'gold'}]); }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) { diff --git a/commands/discord.js b/commands/discord.js index 68c39e7..af937db 100644 --- a/commands/discord.js +++ b/commands/discord.js @@ -4,7 +4,7 @@ module.exports = { description: 'Shows the discord invite', usage: '', trusted: 0, - execute: function(bot) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { bot.tellraw('@a', [ { text: 'The Discord invite is ', diff --git a/commands/eaglercrash.js b/commands/eaglercrash.js index bf890e6..94f00aa 100644 --- a/commands/eaglercrash.js +++ b/commands/eaglercrash.js @@ -5,9 +5,9 @@ module.exports = { description: 'Lags Eaglercraft and crashes it', usage: ' ', trusted: 1, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { if (args[1] === 'on') { - if (args[0] === bot.hash) { + if (args[0] === hash) { bot.eaglercrashstarted = true; bot.eaglercrash = setInterval(async function() { if (bot.eaglercrashstarted === true) return bot.core.run('minecraft:playsound block.note_block.harp record @a ~ ~ ~ 100000000000000000000000000000000000000 1 0'); @@ -18,7 +18,7 @@ module.exports = { } } if (args[1] === 'off') { - if (args[0] === bot.hash) { + if (args[0] === hash) { clearInterval(bot.eaglercrash); bot.eaglercrashstarted = false; bot.core.run('minecraft:tellraw @a ["",{"text":"Eaglercrash stopped","color":"white"}]'); diff --git a/commands/echo.js b/commands/echo.js index a325262..8cf2049 100644 --- a/commands/echo.js +++ b/commands/echo.js @@ -5,7 +5,7 @@ module.exports = { description: 'Says a message', usage: '', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { bot.chat(args.join(' ')); }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) { diff --git a/commands/end.js b/commands/end.js index fbf1aaf..8f23ee5 100644 --- a/commands/end.js +++ b/commands/end.js @@ -5,8 +5,8 @@ module.exports = { description: 'Ends the bot\'s client', usage: '', trusted: 1, - execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0] === bot.hash) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { + if (args[0] === hash) { bot.end('end command'); } else { throw new Error('Invalid hash'); diff --git a/commands/entity.js b/commands/entity.js index 70bd127..f1a24c3 100644 --- a/commands/entity.js +++ b/commands/entity.js @@ -5,7 +5,7 @@ module.exports = { description: 'Summon any entity!', usage: '[specific] ', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { // eslint-disable-next-line no-unused-vars const mcData = require('minecraft-data')(bot.version); diff --git a/commands/eval.js b/commands/eval.js index 1cc835d..014218a 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -15,7 +15,7 @@ module.exports = { '', ' ', ], - execute: function(bot, username, usernameraw, sender, prefix, args, config) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { if (args[0] === 'run') { try { bot.tellraw('@a', {text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 32000)}); diff --git a/commands/executebypass.js b/commands/executebypass.js index 5d432f6..8d01a9e 100644 --- a/commands/executebypass.js +++ b/commands/executebypass.js @@ -5,8 +5,8 @@ module.exports = { description: 'Execute command bypassed', usage: ' ', trusted: 1, - execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0] === bot.hash) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { + if (args[0] === hash) { bot.core.run('minecraft:execute unless entity @s[name= run ] run ' + args.slice(1).join(' ')); } else { throw new Error('Invalid hash'); diff --git a/commands/gamemodeall.js b/commands/gamemodeall.js index 0037214..5dc2a95 100644 --- a/commands/gamemodeall.js +++ b/commands/gamemodeall.js @@ -5,8 +5,8 @@ module.exports = { description: 'Gamemode everyone', usage: ' ', trusted: 1, - execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0] === bot.hash) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { + if (args[0] === hash) { bot.core.run(`minecraft:execute unless entity @s[name= run ] run gamemode ${args[1]} @a[name=!${bot.username}]`); } else { throw new Error('Invalid hash'); diff --git a/commands/help.js b/commands/help.js index 9b82a2a..29dfb61 100644 --- a/commands/help.js +++ b/commands/help.js @@ -8,7 +8,7 @@ module.exports = { description: 'Shows the help', usage: '[command]', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { const generalCommands = []; const trustedCommands = []; const ownerCommands = []; diff --git a/commands/music.js b/commands/music.js index 4ee0220..2fcf6e3 100644 --- a/commands/music.js +++ b/commands/music.js @@ -143,7 +143,7 @@ module.exports = { '', '', ], - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { switch (args[0]) { case 'play': play(bot, args.slice(1)); diff --git a/commands/netmsg.js b/commands/netmsg.js index 48f8f62..71a5eac 100644 --- a/commands/netmsg.js +++ b/commands/netmsg.js @@ -5,7 +5,7 @@ module.exports = { description: 'Broadcasts a message to all of the servers that the bot is connected', usage: '', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args, config) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { const component = [ { text: '[', diff --git a/commands/refillcore.js b/commands/refillcore.js index 375374e..45fbd9e 100644 --- a/commands/refillcore.js +++ b/commands/refillcore.js @@ -4,7 +4,7 @@ module.exports = { description: 'Resets the bot\'s command core', usage: '', trusted: 0, - execute: function(bot) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { bot.core.loopPlace(); }, discordExecute: function(bot) { diff --git a/commands/rtp.js b/commands/rtp.js index 66adc24..a9b2ffb 100644 --- a/commands/rtp.js +++ b/commands/rtp.js @@ -6,7 +6,7 @@ module.exports = { description: 'Randomly teleports the player', usage: '', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { const rtppos = `${between(20000000, 500000)} 100 ${between(20000000, 500000)}`; bot.tellraw('@a', [{text: 'Teleporting ', color: 'white'}, {text: username, color: 'aqua'}, {text: ' to ', color: 'white'}, {text: rtppos, color: 'green'}, {text: '...', color: 'white'}]); bot.core.run(`essentials:teleport ${sender} ${rtppos}`); diff --git a/commands/servereval.js b/commands/servereval.js index 0648745..52558ae 100644 --- a/commands/servereval.js +++ b/commands/servereval.js @@ -7,8 +7,8 @@ module.exports = { description: 'Eval command without vm2', trusted: 2, usage: ' ', - execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0] === bot.ownerHash) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { + if (args[0] === ownerhash) { try { bot.tellraw('@a', {text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 32000)}); } catch (err) { diff --git a/commands/test.js b/commands/test.js index 631ebd2..fe107ce 100644 --- a/commands/test.js +++ b/commands/test.js @@ -6,7 +6,7 @@ module.exports = { description: 'Tests if the bot is working', usage: '', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { bot.tellraw('@a', [ { text: `Username: ${username},`, diff --git a/commands/time.js b/commands/time.js index d6897b8..09a1a7e 100644 --- a/commands/time.js +++ b/commands/time.js @@ -7,7 +7,7 @@ module.exports = { description: 'Shows the time', usage: '', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { const timezone = args.join(' '); const momented = moment().tz(`${timezone}`).format('dddd, MMMM Do, YYYY, hh:mm:ss A'); const component = [{text: 'The current date and time for the timezone ', color: 'white'}, {text: timezone, color: 'aqua'}, {text: ' is: ', color: 'white'}, {text: `${momented}`, color: 'green'}]; diff --git a/commands/tpall.js b/commands/tpall.js index 4f334cb..75789a4 100644 --- a/commands/tpall.js +++ b/commands/tpall.js @@ -5,8 +5,8 @@ module.exports = { description: 'Teleport everyone', usage: ' ', trusted: 1, - execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0] === bot.hash) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { + if (args[0] === hash) { bot.core.run(`minecraft:execute unless entity @s[name= run ] run tp @a ${args.slice(1).join(' ')}`); } else { throw new Error('Invalid hash'); diff --git a/commands/uptime.js b/commands/uptime.js index fb85450..375bd43 100644 --- a/commands/uptime.js +++ b/commands/uptime.js @@ -7,7 +7,7 @@ module.exports = { description: 'Shows the bot\'s uptime', usage: '', trusted: 0, - execute: function(bot) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { bot.tellraw('@a', [{text: 'The bot\'s uptime is ', color: 'white'}, {text: `${secondsToHms(Math.floor(performance.now() / 1000))}`, color: 'green'}]); }, discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) { diff --git a/commands/urban.js b/commands/urban.js index 48c855a..e1b9560 100644 --- a/commands/urban.js +++ b/commands/urban.js @@ -6,7 +6,7 @@ module.exports = { description: 'Working Urban Dictionary', usage: '', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { urban.autocompleteExtra(args[0], (error, results) => { if (error) { bot.tellraw('@a', [{text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: error.message, color: 'red'}]); diff --git a/commands/uuid.js b/commands/uuid.js index aa0c6bc..29e78b6 100644 --- a/commands/uuid.js +++ b/commands/uuid.js @@ -6,7 +6,7 @@ module.exports = { description: 'Gets the UUID of a player. If no player specified it will show your UUID instead', usage: '', trusted: 0, - execute: function(bot, username, usernameraw, sender, prefix, args) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { if (args[0]) { const playername = args.join(' '); const player = bot.playersAddedPlayers[playername]; diff --git a/commands/validate.js b/commands/validate.js index 5324635..9ca4c89 100644 --- a/commands/validate.js +++ b/commands/validate.js @@ -5,10 +5,10 @@ module.exports = { alias: [], usage: '', trusted: 1, - execute: function(bot, username, usernameraw, sender, prefix, args) { - if (args[0] === bot.hash) { + execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) { + if (args[0] === hash) { bot.tellraw('@a', {text: 'Valid hash', color: 'green'}); - } else if (args[0] === bot.ownerHash) { + } else if (args[0] === ownerhash) { bot.tellraw('@a', {text: 'Valid OwnerHash', color: 'green'}); } else { bot.tellraw('@a', {text: 'Invalid hash', color: 'red'}); diff --git a/plugins/commands.js b/plugins/commands.js index 53f8994..2e2d8a5 100644 --- a/plugins/commands.js +++ b/plugins/commands.js @@ -11,7 +11,7 @@ function inject(bot, dcclient, config) { bot.command_handler.commands = loadFiles(path.join(__dirname, config.commandsDir)); }; bot.command_handler.reload(); - bot.command_handler.main = function(prefix, username, usernameraw, message, sender, channeldc) { + bot.command_handler.main = function(prefix, username, usernameraw, message, sender, channeldc, hash, ownerhash) { bot.command_handler.reload(); let raw; let command; @@ -28,7 +28,7 @@ function inject(bot, dcclient, config) { if (typeof command.discordExecute === 'undefined') throw new Error('This command is not yet supported on discord!'); command.discordExecute(bot, username, usernameraw, sender, prefix, args, channeldc, message, config); } else { - command.execute(bot, username, usernameraw, sender, prefix, args, config); + command.execute(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash); } } catch (e) { if (prefix === config.discord.prefix) { @@ -42,10 +42,10 @@ function inject(bot, dcclient, config) { } } }; - bot.command_handler.run = function(username, usernameraw, message, sender, channeldc) { + bot.command_handler.run = function(username, usernameraw, message, sender, channeldc, hash, ownerhash) { for (const prefix of config.prefixes) { if (!message.startsWith(prefix)) continue; - bot.command_handler.main(prefix, username, usernameraw, message, sender, channeldc); + bot.command_handler.main(prefix, username, usernameraw, message, sender, channeldc, hash, ownerhash); } }; bot.on('message', async (_username, _message, _sender) => { @@ -57,7 +57,7 @@ function inject(bot, dcclient, config) { if (!bot.getplayerusername[sender]) username = usernameraw; else username = bot.getplayerusername[sender]; const message = _message.replace(/* /§r/g */ /§[a-f0-9rlonmk]/g, '')/* .replace(/§/g, '')*/; - bot.command_handler.run(username, usernameraw, message, sender); + bot.command_handler.run(username, usernameraw, message, sender, channeldc, bot.hash, bot.ownerHash); } catch (e) { bot.console.error(e); } diff --git a/plugins/console.js b/plugins/console.js index e76440b..7a778fe 100644 --- a/plugins/console.js +++ b/plugins/console.js @@ -105,6 +105,9 @@ function inject(bot, _dcclient, config, rl) { bot.username, '*' + line.substring(1), bot.uuid, + null, + 'h', + 'o', ); } bot.tellraw('@a', [ diff --git a/plugins/proxy.js b/plugins/proxy.js new file mode 100644 index 0000000..96870ec --- /dev/null +++ b/plugins/proxy.js @@ -0,0 +1,95 @@ +/* eslint-disable require-jsdoc */ +const mc = require('minecraft-protocol'); + +function inject(bot, dcclient, config) { + config.servers.forEach((server, index) => { + if (server.host !== bot.options.host) return; + + const {MessageBuilder} = require('prismarine-chat')(bot.version); + + const version = bot.version; + const srv = mc.createServer({ + 'online-mode': false, + 'port': 25566 + index, + 'keepAlive': false, + version, + }); + + srv.on('login', function(client) { + bot.console.info(`[Proxy] ${client.username} connected to proxy`); + let endedClient = false; + let endedTarget = false; + + const targetClient = mc.createClient({ + username: client.username, + host: bot.options.host, + version, + }); + + targetClient.on('packet', (data, meta) => { + if (!endedClient && + meta.state === mc.states.PLAY && + client.state === mc.states.PLAY + ) client.write(meta.name, data); + }); + + targetClient.on('error', () => {}); + + targetClient.on('end', () => { + targetClient.end(); + endedTarget = true; + }); + + client.on('end', function() { + endedClient = true; + targetClient.end(); + bot.console.info(`[Proxy] ${client.username} ended`); + }); + + client.on('error', function() { + endedClient = true; + bot.console.info(`[Proxy] ${client.username} got error`); + }); + + client.on('packet', (data, meta) => { + if (meta.name === 'chat' && !data.message?.startsWith('/')) { + if (data.message.startsWith('.')) { + return bot.command_handler.run( + client.username, + client.username, + '*' + data.message.substring(1), + client.uuid, + null, + 'h', + 'o', + ); + } + bot.tellraw('@a', { + color: 'dark_gray', + translate: '[%s] [%s] %s \u203a %s', + with: [ + { + text: 'Chat', + color: 'gray', + }, + { + text: 'Proxy', + color: 'gray', + }, + { + text: client.username, + color: 'green', + }, + MessageBuilder.fromString('&7' + data.message), + ], + }); + return; + } + targetClient.write(meta.name, data); + }); + bot.on('end', () => srv.close()); + }); + }); +}; + +module.exports = {inject};