Case insensitive check for ignored chat commands

Fixes #651
This commit is contained in:
Brokkonaut
2018-07-31 16:16:02 +02:00
parent 759cd230a1
commit 354c9078b1
2 changed files with 9 additions and 6 deletions

View File

@@ -376,9 +376,12 @@ public class Consumer extends TimerTask {
} }
public void queueChat(Actor player, String message) { public void queueChat(Actor player, String message) {
for (String ignored : Config.ignoredChat) { if (!Config.ignoredChat.isEmpty()) {
if (message.startsWith(ignored)) { String lowerCaseMessage = message.toLowerCase();
return; for (String ignored : Config.ignoredChat) {
if (lowerCaseMessage.startsWith(ignored)) {
return;
}
} }
} }
if (hiddenPlayers.contains(player.getName().toLowerCase())) { if (hiddenPlayers.contains(player.getName().toLowerCase())) {

View File

@@ -44,7 +44,7 @@ public class Config {
public static String banPermission; public static String banPermission;
public static Set<Material> hiddenBlocks; public static Set<Material> hiddenBlocks;
public static Set<String> hiddenPlayers; public static Set<String> hiddenPlayers;
public static Set<String> ignoredChat; public static List<String> ignoredChat;
public static SimpleDateFormat formatter; public static SimpleDateFormat formatter;
public static boolean safetyIdCheck; public static boolean safetyIdCheck;
public static boolean debug; public static boolean debug;
@@ -176,9 +176,9 @@ public class Config {
throw new DataFormatException("Not a valid material in hiddenBlocks: '" + blocktype + "'"); throw new DataFormatException("Not a valid material in hiddenBlocks: '" + blocktype + "'");
} }
} }
ignoredChat = new HashSet<String>(); ignoredChat = new ArrayList<String>();
for (String chatCommand : config.getStringList("logging.ignoredChat")) { for (String chatCommand : config.getStringList("logging.ignoredChat")) {
ignoredChat.add(chatCommand); ignoredChat.add(chatCommand.toLowerCase());
} }
dontRollback = new HashSet<Material>(); dontRollback = new HashSet<Material>();
for (String e : config.getStringList("rollback.dontRollback")) { for (String e : config.getStringList("rollback.dontRollback")) {