From a6e34c040b1df44d2e0eb9f5a0b767c0529d4250 Mon Sep 17 00:00:00 2001 From: spjspj Date: Sat, 18 Feb 2017 20:32:22 +1100 Subject: [PATCH] Limit messages to 500 characters --- Mage.Server/src/main/java/mage/server/ChatManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mage.Server/src/main/java/mage/server/ChatManager.java b/Mage.Server/src/main/java/mage/server/ChatManager.java index 521fd616b0..b8f655733f 100644 --- a/Mage.Server/src/main/java/mage/server/ChatManager.java +++ b/Mage.Server/src/main/java/mage/server/ChatManager.java @@ -132,6 +132,10 @@ public class ChatManager { chatSessions.get(chatId).broadcastInfoToUser(user, informUser); return; } + + if (message.length() > 500) { + message = message.replaceFirst("^(.{500}).*", "$1 (rest of message truncated)"); + } String messageToCheck = message; Matcher matchPattern = cardNamePattern.matcher(message);