0

try/catched module enabling

This commit is contained in:
Pepich 2017-02-02 20:49:10 +01:00
parent fb5e6fa10b
commit 907c68525b

View File

@ -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,10 +64,13 @@ public final class ModuleLoader implements CoreModule
{
if (module.enabled())
continue;
try
{
if (module.enable())
{
CommandManager.registerCommand(module.getCommandString(), module, Main.plugin);
if (module.getClass().isAnnotationPresent(AutoRegisterListener.class) && (module instanceof Listener))
if (module.getClass().isAnnotationPresent(AutoRegisterListener.class)
&& (module instanceof Listener))
{
Bukkit.getPluginManager().registerEvents((Listener) module, Main.plugin);
}
@ -76,6 +79,11 @@ public final class ModuleLoader implements CoreModule
else
Utils.error("Failed to load module " + module.getClass().getName());
}
catch (Exception e)
{
Utils.error("Failed to load module " + module.getClass().getName());
}
}
}
/** This method enables a specific module. If no module with that name is known to the loader yet it will be added to the list.