This commit is contained in:
Chipmunk 2023-04-30 21:18:49 -04:00
parent 5552542461
commit 09c1357e1c

View file

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