ignore long messages/commands

This commit is contained in:
Chayapak 2023-07-04 21:06:31 +07:00
parent 5cef742fef
commit d63adca59a

View file

@ -49,11 +49,15 @@ public class ChatPlugin extends SessionAdapter {
} }
public void message (String message) { public void message (String message) {
if (message.length() > 256) return;
final ServerboundChatPacket packet = new ServerboundChatPacket(message, Instant.now().toEpochMilli(), 0, null, 0, new BitSet()); final ServerboundChatPacket packet = new ServerboundChatPacket(message, Instant.now().toEpochMilli(), 0, null, 0, new BitSet());
client.session().send(packet); client.session().send(packet);
} }
public void command (String command) { 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()); final ServerboundChatCommandPacket packet = new ServerboundChatCommandPacket(command, Instant.now().toEpochMilli(), 0, Collections.emptyList(), 0, new BitSet());
client.session().send(packet); client.session().send(packet);
} }