diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index b252d5ba3..94c7b494d 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -348,6 +348,7 @@ public class AuthMe extends JavaPlugin { // Initialize and setup the database public void setupDatabase() throws Exception { + if (database != null) database.close(); // Backend MYSQL - FILE - SQLITE - SQLITEHIKARI boolean isSQLite = false; switch (Settings.getDataSource) { @@ -704,6 +705,10 @@ public class AuthMe extends JavaPlugin { return count >= Settings.getMaxJoinPerIp; } + public ModuleManager getModuleManager() { + return moduleManager; + } + /** * Get Player real IP through VeryGames method * @@ -736,5 +741,4 @@ public class AuthMe extends JavaPlugin { public String getCountryName(String ip) { return Utils.getCountryName(ip); } - } diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 573d956fe..49042a433 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -110,11 +110,12 @@ public class AdminCommand implements CommandExecutor { } else if (args[0].equalsIgnoreCase("reload")) { try { Settings.reload(); + plugin.getModuleManager().reloadModules(); m.reloadMessages(); - plugin.database.close(); plugin.setupDatabase(); } catch (Exception e) { ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!"); + ConsoleLogger.writeStackTrace(e); plugin.stopOrUnload(); return false; } diff --git a/src/main/java/fr/xephi/authme/modules/ModuleManager.java b/src/main/java/fr/xephi/authme/modules/ModuleManager.java index 32d4d1fa6..0d598fc49 100644 --- a/src/main/java/fr/xephi/authme/modules/ModuleManager.java +++ b/src/main/java/fr/xephi/authme/modules/ModuleManager.java @@ -112,6 +112,11 @@ public class ModuleManager { return count; } + public void reloadModules(){ + unloadModules(); + loadModules(); + } + public void unloadModule(String name) { Iterator it = modules.iterator(); while (it.hasNext()) {