From 5e6836a8f6418fad72fe77072d405ce4e834cf65 Mon Sep 17 00:00:00 2001 From: spjspj Date: Sun, 24 Jul 2016 01:56:05 +1000 Subject: [PATCH] spjspj - Prevent some types of spam in the main chat --- Mage.Server/src/main/java/mage/server/ChatManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Mage.Server/src/main/java/mage/server/ChatManager.java b/Mage.Server/src/main/java/mage/server/ChatManager.java index c8d95300c5..910e7839bf 100644 --- a/Mage.Server/src/main/java/mage/server/ChatManager.java +++ b/Mage.Server/src/main/java/mage/server/ChatManager.java @@ -106,6 +106,7 @@ public class ChatManager { this.broadcast(chatId, userName, message, color, withTime, messageType, null); } + static String lastMessage = ""; public void broadcast(UUID chatId, String userName, String message, MessageColor color, boolean withTime, MessageType messageType, SoundToPlay soundToPlay) { ChatSession chatSession = chatSessions.get(chatId); if (chatSession != null) { @@ -118,6 +119,11 @@ public class ChatManager { return; } } + + if (message.equals(lastMessage)) { + return; + } + lastMessage = message; chatSession.broadcast(userName, message, color, withTime, messageType, soundToPlay); } }