Put this function in a better place.

This commit is contained in:
GJ 2013-08-20 15:12:38 -04:00
parent 83c4d09093
commit c8c76f4174
4 changed files with 14 additions and 11 deletions

View File

@ -780,9 +780,10 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
} }
// Check if there were any errors // Check if there were any errors
if (Misc.noErrorsInConfig(reason)) { if (noErrorsInConfig(reason)) {
mcMMO.p.debug("No errors found in " + fileName + "!"); mcMMO.p.debug("No errors found in " + fileName + "!");
} else { }
else {
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p); mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
mcMMO.p.noErrorsInConfigFiles = false; mcMMO.p.noErrorsInConfigFiles = false;

View File

@ -7,11 +7,13 @@ import java.io.FileWriter;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.metrics.MetricsManager; import com.gmail.nossr50.metrics.MetricsManager;
public abstract class AutoUpdateConfigLoader extends ConfigLoader { public abstract class AutoUpdateConfigLoader extends ConfigLoader {
@ -125,4 +127,12 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
} }
} }
} }
protected boolean noErrorsInConfig(List<String> issues) {
for (String issue : issues) {
mcMMO.p.getLogger().warning(issue);
}
return issues.isEmpty();
}
} }

View File

@ -199,7 +199,7 @@ public class Config extends AutoUpdateConfigLoader {
} }
// Check if there were any errors // Check if there were any errors
if (Misc.noErrorsInConfig(reason)) { if (noErrorsInConfig(reason)) {
mcMMO.p.debug("No errors found in " + fileName + "!"); mcMMO.p.debug("No errors found in " + fileName + "!");
} }
else { else {

View File

@ -302,14 +302,6 @@ public final class Misc {
return partialName; return partialName;
} }
public static boolean noErrorsInConfig(List<String> issues) {
for (String issue : issues) {
mcMMO.p.getLogger().warning(issue);
}
return issues.isEmpty();
}
public static Random getRandom() { public static Random getRandom() {
return random; return random;
} }