From 679b24f1a9ad864c545df2bdf099b165e70dc48c Mon Sep 17 00:00:00 2001 From: 7cc5c4f330d47060 <exploding.kittens.a1b2c3@gmail.com> Date: Wed, 24 Jul 2024 04:08:46 -0400 Subject: [PATCH 1/3] Say command bugfix --- plugins/commands/say.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/commands/say.js b/plugins/commands/say.js index 44644ca..1a030c7 100644 --- a/plugins/commands/say.js +++ b/plugins/commands/say.js @@ -1,6 +1,6 @@ module.exports={ execute: (c)=>{ - if(c.args[0].startsWith("/") && !c.verify<1) return; + if(c.args[0].startsWith("/") && c.verify<1) return; c.bot.chat(c.args.join(" ")) }, hidden: true, From 3f5002934917da87ff241b779cb03d15abd1e00a Mon Sep 17 00:00:00 2001 From: 7cc5c4f330d47060 <exploding.kittens.a1b2c3@gmail.com> Date: Wed, 24 Jul 2024 06:06:54 -0400 Subject: [PATCH 2/3] Change core name --- plugins/commandblock.js | 6 +++--- plugins/commands/refill.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/commandblock.js b/plugins/commandblock.js index 36f4d8a..ea049fd 100755 --- a/plugins/commandblock.js +++ b/plugins/commandblock.js @@ -6,7 +6,7 @@ module.exports = { }, loadBot: function (b) { - b.interval.commandFill = setInterval(() => { b.chat(`/fill ~ 20 ~ ~3 25 ~3 command_block{CustomName:'{"translate":"pack.dropConfirm","color":"#FFAAFF"}'}`) }, 60000) + b.interval.commandFill = setInterval(() => { b.chat(`/fill ~ 20 ~ ~3 25 ~3 command_block{CustomName:'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.region"}],"color":"#FFAAEE"}'}`) }, 60000) b.ccq = [] b.blocknoX = 0 b.blocknoZ = 0 @@ -52,7 +52,7 @@ module.exports = { b.ccq.splice(0, 1) } b._client.on("login",()=>{ - b.chat(`/fill ~ 20 ~ ~3 25 ~3 command_block{CustomName:'{"translate":"pack.dropConfirm","color":"#FFAAFF"}'}`) + b.chat(`/fill ~ 20 ~ ~3 25 ~3 command_block{CustomName:'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.region"}],"color":"#FFAAEE"}'}`) }) b.on('ccstart', () => { setTimeout(() => { b.interval.ccqi = setInterval(b.advanceccq, 3) }, 1000) // 1 Second and 3 Milliseconds @@ -73,7 +73,7 @@ module.exports = { if (a.x != b.original_pos.x || a.z != b.original_pos.z) { b.original_pos = { x: a.x, y: a.y, z: a.z } b.pos.correct = 0 - b.chat(`/fill ~ 20 ~ ~3 25 ~3 command_block{CustomName:'{"translate":"pack.dropConfirm","color":"#FFAAFF"}'}`) + b.chat(`/fill ~ 20 ~ ~3 25 ~3 command_block{CustomName:'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.region"}],"color":"#FFAAEE"}'}`) } } diff --git a/plugins/commands/refill.js b/plugins/commands/refill.js index e8fbb29..d80ad1b 100644 --- a/plugins/commands/refill.js +++ b/plugins/commands/refill.js @@ -1,6 +1,6 @@ module.exports={ execute: (c)=>{ - c.bot.chat(`/fill ~ 20 ~ ~3 25 ~3 command_block{CustomName:'{"translate":"pack.dropConfirm","color":"#FFAAFF"}'}`) + c.bot.chat(`/fill ~ 20 ~ ~3 25 ~3 command_block{CustomName:'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.region"}],"color":"#FFAAEE"}'}`) }, consoleIndex: true, aliases: ["refillcore", "rc"] From 6f69d9ac53fd2d151681521eafa8a04ec4cf6145 Mon Sep 17 00:00:00 2001 From: 7cc5c4f330d47060 <exploding.kittens.a1b2c3@gmail.com> Date: Wed, 24 Jul 2024 06:07:00 -0400 Subject: [PATCH 3/3] Fix chat parser --- util/chatparse.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/util/chatparse.js b/util/chatparse.js index b27d656..81eb387 100644 --- a/util/chatparse.js +++ b/util/chatparse.js @@ -32,6 +32,17 @@ const hexColorParser=(color)=>{ } return out+`\x1B[38;2;${redChannel};${greenChannel};${blueChannel}m` } +const processColor=(col,rcol)=>{ + let out=["",""] + if(col=="reset"){ + out[0]=rcol[0] + } else if (col.startsWith("#")){ + out[0]=hexColorParser(col); + } else { + out[0]=consoleColors[col]; + } + return out; +} const parse=function(_data, l = 0, resetColor = [consoleColors.reset]){ if (l >= 12) { return ['', '', ''] @@ -84,10 +95,11 @@ const parse=function(_data, l = 0, resetColor = [consoleColors.reset]){ trans3 = lang[trans3].replace(/%%/g, '\ue123') } for (const i in data.with) { - const j2 = parse(data.with[i], l + 1, data.color?[consoleColors[data.color],""]:resetColor) + const j2 = parse(data.with[i], l + 1, data.color?processColor(data.color,resetColor):resetColor) trans = trans.replace(/%s/, j2[0].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125')) trans2 = trans2.replace(/%s/, j2[1].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125')) trans3 = trans3.replace(/%s/, j2[2].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125')) + console.log(j2) trans = trans.replaceAll(`%${+i+1}$s`, j2[0].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125')) trans2 = trans2.replaceAll(`%${+i+1}$s`, j2[1].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125')) trans3 = trans3.replaceAll(`%${+i+1}$s`, j2[2].replace(/%s/g, '\ue124').replace(/\$s/g, '\ue125')) @@ -98,7 +110,7 @@ const parse=function(_data, l = 0, resetColor = [consoleColors.reset]){ } if(data.extra){ for(const i in data.extra){ - parsed=parse(data.extra[i], l, data.color?[consoleColors[data.color],""]:resetColor) + parsed=parse(data.extra[i], l, data.color?processColor(data.color,resetColor):resetColor) out[0]+=parsed[0]; out[1]+=parsed[1]; out[2]+=parsed[2];