From d63adca59afa8047d431b124e62b44fd2fcebb3d Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Tue, 4 Jul 2023 21:06:31 +0700 Subject: [PATCH] ignore long messages/commands --- .../java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java b/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java index b913664..56a49bc 100644 --- a/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java +++ b/src/main/java/land/chipmunk/chipmunkbot/plugins/ChatPlugin.java @@ -49,11 +49,15 @@ public class ChatPlugin extends SessionAdapter { } public void message (String message) { + if (message.length() > 256) return; + final ServerboundChatPacket packet = new ServerboundChatPacket(message, Instant.now().toEpochMilli(), 0, null, 0, new BitSet()); client.session().send(packet); } public void command (String command) { + if (command.length() > 256) return; + final ServerboundChatCommandPacket packet = new ServerboundChatCommandPacket(command, Instant.now().toEpochMilli(), 0, Collections.emptyList(), 0, new BitSet()); client.session().send(packet); }