Don't try to register listeners when mcMMO was disabled

This commit is contained in:
TfT_02 2013-08-10 19:33:21 +02:00
parent ead1398132
commit 4ff6b5fbc7
3 changed files with 9 additions and 5 deletions

View File

@ -777,6 +777,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
} 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;
} }
} }

View File

@ -203,6 +203,7 @@ public class Config extends AutoUpdateConfigLoader {
} 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;
} }
} }

View File

@ -78,6 +78,9 @@ public class mcMMO extends JavaPlugin {
private static boolean spoutEnabled; private static boolean spoutEnabled;
private static boolean combatTagEnabled; private static boolean combatTagEnabled;
// Config Validation Check
public boolean noErrorsInConfigFiles = true;
// XP Event Check // XP Event Check
private boolean xpEventEnabled; private boolean xpEventEnabled;
@ -109,6 +112,10 @@ public class mcMMO extends JavaPlugin {
setupSpout(); setupSpout();
loadConfigFiles(); loadConfigFiles();
if (!noErrorsInConfigFiles) {
return;
}
combatTagEnabled = getServer().getPluginManager().getPlugin("CombatTag") != null; combatTagEnabled = getServer().getPluginManager().getPlugin("CombatTag") != null;
databaseManager = DatabaseManagerFactory.getDatabaseManager(); databaseManager = DatabaseManagerFactory.getDatabaseManager();
@ -307,11 +314,6 @@ public class mcMMO extends JavaPlugin {
repairables.addAll(rManager.getLoadedRepairables()); repairables.addAll(rManager.getLoadedRepairables());
repairableManager = RepairableManagerFactory.getRepairManager(repairables.size()); repairableManager = RepairableManagerFactory.getRepairManager(repairables.size());
repairableManager.registerRepairables(repairables); repairableManager.registerRepairables(repairables);
// Check if Repair Anvil and Salvage Anvil have different itemID's
if (Config.getInstance().getSalvageAnvilId() == Config.getInstance().getRepairAnvilId()) {
getLogger().warning("Can't use the same itemID for Repair/Salvage Anvils!");
}
} }
private void setupSpout() { private void setupSpout() {