So im coding a auto-kick plugin wich will kick anybody who writes a word wich is located in a config called "Blacklist". This is how my plugin currently checks if the msg contains that certain word: Code: List <String> blacklist = cfg.getStringList("blacklist"); for (String insults : blacklist) { if(e.getMessage().contains(insults)) { It works fine but it does not work if for example in the config i entered the word "fuck" and someone writes the word "FUCK". any help?
@TheFl4me Instead of doing Collection#contains(...), iterate through the Collection looking for the word, using String#equalsIgnoreCase(...).
I get how this would work if a player would write a single word in chat. But would this also work if the player writes more then just the specified word?
Just saying, what you have there will only count it if it 's spelled exactly like it is in the list. So if you put "hi" into the list, it won't detect "HI". To fix that, do StringUtils#containsIgnoreCase
@FisheyLP You never read the whole thread, right? He just said it works. Thats why the thread is marked solved.