mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-20 02:33:15 +01:00
Validate in a seperate function.
This commit is contained in:
@@ -92,6 +92,10 @@ public abstract class ConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean validateKeys() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean noErrorsInConfig(List<String> issues) {
|
||||
for (String issue : issues) {
|
||||
plugin.getLogger().warning(issue);
|
||||
@@ -99,4 +103,15 @@ public abstract class ConfigLoader {
|
||||
|
||||
return issues.isEmpty();
|
||||
}
|
||||
|
||||
protected void validate() {
|
||||
if (validateKeys()) {
|
||||
plugin.debug("No errors found in " + fileName + "!");
|
||||
}
|
||||
else {
|
||||
plugin.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
||||
plugin.getServer().getPluginManager().disablePlugin(plugin);
|
||||
plugin.noErrorsInConfigFiles = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user