diff --git a/src/main/java/com/bgsoftware/superiorskyblock/commands/admin/CmdAdminModules.java b/src/main/java/com/bgsoftware/superiorskyblock/commands/admin/CmdAdminModules.java index 01d163476..4aab5cf8c 100644 --- a/src/main/java/com/bgsoftware/superiorskyblock/commands/admin/CmdAdminModules.java +++ b/src/main/java/com/bgsoftware/superiorskyblock/commands/admin/CmdAdminModules.java @@ -86,11 +86,11 @@ public void execute(SuperiorSkyblockPlugin plugin, CommandSender sender, String[ File moduleFile = new File(plugin.getDataFolder(), "modules/" + args[2] + ".jar"); try { pluginModule = plugin.getModules().registerModule(moduleFile); - Message.MODULE_LOADED_SUCCESS.send(sender, pluginModule.getName()); } catch (Exception ex) { Message.MODULE_LOADED_FAILURE.send(sender, args[2]); ex.printStackTrace(); PluginDebugger.debug(ex); + return; } } else { if (pluginModule.isInitialized()) { @@ -99,9 +99,11 @@ public void execute(SuperiorSkyblockPlugin plugin, CommandSender sender, String[ } plugin.getModules().registerModule(pluginModule); - Message.MODULE_LOADED_SUCCESS.send(sender, pluginModule.getName()); } + plugin.getModules().enableModule(pluginModule); + Message.MODULE_LOADED_SUCCESS.send(sender, pluginModule.getName()); + break; case "unload": if (pluginModule == null) { diff --git a/src/main/java/com/bgsoftware/superiorskyblock/module/ModulesManagerImpl.java b/src/main/java/com/bgsoftware/superiorskyblock/module/ModulesManagerImpl.java index b5dd50045..7a6c85115 100644 --- a/src/main/java/com/bgsoftware/superiorskyblock/module/ModulesManagerImpl.java +++ b/src/main/java/com/bgsoftware/superiorskyblock/module/ModulesManagerImpl.java @@ -56,7 +56,10 @@ public void registerModule(PluginModule pluginModule) { @Override public PluginModule registerModule(File moduleFile) throws IOException, ReflectiveOperationException { - if (!moduleFile.exists() || !moduleFile.getName().endsWith(".jar")) + if (!moduleFile.exists()) + throw new IllegalArgumentException("The given file does not exist."); + + if (!moduleFile.getName().endsWith(".jar")) throw new IllegalArgumentException("The given file is not a valid jar file."); String moduleName = moduleFile.getName().replace(".jar", "");