From 09c1357e1c8afa9c18a156f0b3cb334d6c2a7322 Mon Sep 17 00:00:00 2001 From: Chipmunk <65827213+ChipmunkMC@users.noreply.github.com> Date: Sun, 30 Apr 2023 21:18:49 -0400 Subject: [PATCH] whoops --- .../chipmunk/chipmunkbot/plugins/ChatPlugin.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java b/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java index 2b40cc4..408c844 100644 --- a/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java +++ b/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java @@ -128,23 +128,25 @@ public class ChatPlugin extends SessionAdapter { if (command.length() > maxLength) { String tagString; - boolean inspect; - CompoundTag itemTag = new CompoundTag(""); + boolean interpret; if (message instanceof TextComponent && message.style().isEmpty() && (message.children() == null || message.children().size() == 0)) { tagString = ((TextComponent) message).content(); - inspect = false; + interpret = false; } else { tagString = raw; - inspect = true; + interpret = true; } if (tagString.getBytes(StandardCharsets.UTF_8).length > 65535) return; + CompoundTag itemTag = new CompoundTag(""); + itemTag.put(new StringTag("m", tagString)); + final Session session = client.session(); session.send(new ServerboundSetCreativeModeSlotPacket(26, new ItemStack(1 /* stone */, 1, itemTag))); - client.core().run("minecraft:tellraw " + targets + " {\"nbt\":\"SelectedItem.tag.m\",\"entity\":\"" + uuid.toString() + "\",\"inspect\":" + inspect + "}"); // TODO: Use GSON instead of concatenating strings, and hardcode less of this (it shouldn't matter here but yes) + client.core().run("minecraft:tellraw " + targets + " {\"nbt\":\"Inventory[0].tag.m\",\"entity\":\"" + uuid.toString() + "\",\"interpret\":" + interpret + "}"); // TODO: Use GSON instead of concatenating strings, and hardcode less of this (it shouldn't matter here but yes) return; }