mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 14:38:49 +00:00
Handle empty or misconfigured filters.filters
This commit is contained in:
1 parent
3d0e875a4d
commit
8045a71733
1 file changed
+12
-9
@@ -35,20 +35,23 @@ public class FilterHandler implements Listener {
|
||||
FileConfiguration config = carbonChat.getModConfig();
|
||||
ConfigurationSection filters = config.getConfigurationSection("filters.filters");
|
||||
|
||||
for (String replacement : filters.getKeys(false)) {
|
||||
List<Pattern> patterns = new ArrayList<>();
|
||||
if (filters != null) {
|
||||
for (String replacement : filters.getKeys(false)) {
|
||||
List<Pattern> patterns = new ArrayList<>();
|
||||
|
||||
for (String word : filters.getStringList(replacement)) {
|
||||
if (carbonChat.getModConfig().getBoolean("filters.case-sensitive")) {
|
||||
patterns.add(Pattern.compile(word));
|
||||
} else {
|
||||
patterns.add(Pattern.compile(word, Pattern.CASE_INSENSITIVE));
|
||||
for (String word : filters.getStringList(replacement)) {
|
||||
if (carbonChat.getModConfig().getBoolean("filters.case-sensitive")) {
|
||||
patterns.add(Pattern.compile(word));
|
||||
} else {
|
||||
patterns.add(Pattern.compile(word, Pattern.CASE_INSENSITIVE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
patternReplacements.put(replacement, patterns);
|
||||
patternReplacements.put(replacement, patterns);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (String replacement : config.getStringList("filters.blocked-words")) {
|
||||
for (String word : filters.getStringList(replacement)) {
|
||||
if (carbonChat.getModConfig().getBoolean("filters.case-sensitive")) {
|
||||
|
||||
Reference in new issue
Block a user