Modify the profanity filter to push it back to client side only.

This commit is contained in:
spjspj 2017-01-27 12:38:31 +11:00
parent 6625bf86be
commit f41d81f8e4
4 changed files with 75 additions and 17 deletions

View file

@ -110,13 +110,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) {
@ -170,11 +163,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) {