package io.github.jacobmarshall.meloooncensor.filter;

import io.github.jacobmarshall.meloooncensor.config.Configuration;

import java.util.regex.Pattern;


public class WordFilter extends ClassicFilter {
    private static final Pattern WORD_SPLIT = Pattern.compile("\\s");

    public WordFilter(Configuration configuration) {
        super(configuration);
    }

    @Override
    protected boolean isCensoredWord(String word) {
        return config.getCensor().contains(word);
    }

    @Override
    protected boolean isIgnoredWord(String word) {
        return config.getIgnore().contains(word);
    }

    @Override
    public boolean violatesPolicy(String message) {
        String[] words = WORD_SPLIT.split(message);
        for (String word : words) {
            if (config.getCensor().contains(word.toLowerCase())) {
                return true;
            }
        }
        return false;
    }
}

@@ -120,41 +120,8 @@
 n;%0A%0A
-import java.util.regex.Pattern;%0A%0A
 %0Apub
@@ -169,79 +169,8 @@
 r %7B%0A
-    private static final Pattern WORD_SPLIT = Pattern.compile(%22%5C%5Cs%22);%0A%0A
     
@@ -360,32 +360,46 @@
 ().contains(word
+.toLowerCase()
 );%0A    %7D%0A%0A    @O
@@ -508,312 +508,23 @@
 word
-);%0A    %7D%0A%0A    @Override%0A    public boolean violatesPolicy(String message) %7B%0A        String%5B%5D words = WORD_SPLIT.split(message);%0A        for (String word : words) %7B%0A            if (config.getCensor().contains(word.toLowerCase())) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return false
+.toLowerCase())
 ;%0A  

Simplify WordFilter.