SpigotMC/Spigot — pull request #70 by Mati0703 (2013-11-19 13:07:59+00:00)
Title: [Snapshot] Fix sting to long for new json chat system.

If there is about 100 players on server and someone will use /list they will be kicked from server. Becouse Json string is too long.

To fix this we can check string lenght and next send chat packet.

public void sendRawMessage(String message) {
if (getHandle().playerConnection == null) return;

for (String msg : message.split("\n")) {

String JsonMessage = ChatConverter.toJSONChat(msg);

if (JsonMessage.length() < 32760) {
getHandle().playerConnection.sendPacket(new Packet3Chat(JsonMessage));
} else {
getHandle().playerConnection.sendPacket(new Packet3Chat(ChatMessage.d(message)));
}

}
}

32760 is chat limit minus safety number to avoid bugs