Merge pull request #2819 from spjspj/master

Modify the profanity filter to push it back to client side only.
This commit is contained in:
spjspj 2017-01-27 12:39:37 +11:00 committed by GitHub
commit c2e41640e8
4 changed files with 75 additions and 17 deletions

View file

@ -107,13 +107,6 @@ public class ChatManager {
this.broadcast(chatId, userName, message, color, withTime, messageType, null);
}
private boolean containsSwearing(String message) {
if (message != null && message.toLowerCase().matches("^.*(anal|asshole|balls|bastard|bitch|blowjob|cock|crap|cunt|cum|damn|dick|dildo|douche|fag|fuck|idiot|moron|penis|piss|prick|pussy|rape|rapist|sex|screw|shit|slut|vagina).*$")) {
return true;
}
return false;
}
final Pattern cardNamePattern = Pattern.compile("\\[(.*?)\\]");
public void broadcast(UUID chatId, String userName, String message, MessageColor color, boolean withTime, MessageType messageType, SoundToPlay soundToPlay) {
@ -167,11 +160,6 @@ public class ChatManager {
}
userMessages.put(userName, message);
if (containsSwearing(messageToCheck)) {
String informUser = "Your message appears to contain profanity";
chatSessions.get(chatId).broadcastInfoToUser(user, informUser);
return;
}
}
if (messageType == MessageType.TALK) {