diff --git a/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java b/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java index d740047..a3e438d 100644 --- a/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java +++ b/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java @@ -5,6 +5,7 @@ import land.chipmunk.chipmunkbot.data.chat.PlayerMessage; import land.chipmunk.chipmunkbot.data.chat.SystemChatParser; import land.chipmunk.chipmunkbot.data.MutablePlayerListEntry; import land.chipmunk.chipmunkbot.util.UUIDUtilities; +import land.chipmunk.chipmunkbot.util.ComponentUtilities; // sus import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerChatPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisguisedChatPacket; @@ -106,7 +107,10 @@ public class ChatPlugin extends SessionAdapter { // ? Should this be here? public void tellraw (Component message, String targets) { - client.core.run("minecraft:tellraw " + targets + " " + GsonComponentSerializer.gson().serialize(message)); + final int maxLength = client.core().maxCommandLength(); + String command = "minecraft:tellraw " + targets + " " + GsonComponentSerializer.gson().serialize(message); + if (command.length() > maxLength) command = "w " + targets + " " + ComponentUtilities.stringify(message); + client.core().run(command); } public void tellraw (Component message) { tellraw(message, "@a"); } public void tellraw (Component message, UUID uuid) { tellraw(message, UUIDUtilities.selector(uuid)); }