When someone enters a new regex incorrectly don't crash the whole plugin
This commit is contained in:
parent
9957158758
commit
7c15731dcd
|
|
@ -173,8 +173,15 @@ public final class RegexConfig {
|
|||
String regex = entry.getValue().getNode("regex").getString();
|
||||
String replacement = entry.getValue().getNode("replacement").getString();
|
||||
List<String> exclusions = entry.getValue().getNode("exclusions").getList(TypeToken.of(String.class), new ArrayList<>());
|
||||
if (type == null || type.isEmpty() || regex == null || regex.isEmpty()) {
|
||||
ALogger.warn("Filter: " + name + " was set up incorrectly");
|
||||
} else {
|
||||
if (replacement == null || replacement.isEmpty()) {
|
||||
replacement = name;
|
||||
}
|
||||
ChatFilter chatFilter = new ChatFilter(name, type, regex, replacement, exclusions);
|
||||
RegexManager.addFilter(chatFilter);
|
||||
}
|
||||
} catch(ObjectMappingException ex) {
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user