From 907c68525bba208dbc04130b6a1d2d116f0aaa86 Mon Sep 17 00:00:00 2001 From: Pepich Date: Thu, 2 Feb 2017 20:49:10 +0100 Subject: [PATCH] try/catched module enabling --- .../coremods/moduleLoader/ModuleLoader.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java b/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java index 1a14906..5a305b1 100644 --- a/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java +++ b/src/com/redstoner/coremods/moduleLoader/ModuleLoader.java @@ -21,7 +21,7 @@ import com.redstoner.modules.Module; /** The module loader, mother of all modules. Responsible for loading and taking care of all modules. * * @author Pepich */ -@Version(major = 1, minor = 3, revision = 1, compatible = -1) +@Version(major = 1, minor = 3, revision = 2, compatible = -1) public final class ModuleLoader implements CoreModule { private static ModuleLoader instance; @@ -64,17 +64,25 @@ public final class ModuleLoader implements CoreModule { if (module.enabled()) continue; - if (module.enable()) + try { - CommandManager.registerCommand(module.getCommandString(), module, Main.plugin); - if (module.getClass().isAnnotationPresent(AutoRegisterListener.class) && (module instanceof Listener)) + if (module.enable()) { - Bukkit.getPluginManager().registerEvents((Listener) module, Main.plugin); + CommandManager.registerCommand(module.getCommandString(), module, Main.plugin); + if (module.getClass().isAnnotationPresent(AutoRegisterListener.class) + && (module instanceof Listener)) + { + Bukkit.getPluginManager().registerEvents((Listener) module, Main.plugin); + } + Utils.log("Loaded module " + module.getClass().getName()); } - Utils.log("Loaded module " + module.getClass().getName()); + else + Utils.error("Failed to load module " + module.getClass().getName()); } - else + catch (Exception e) + { Utils.error("Failed to load module " + module.getClass().getName()); + } } }