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; }