added reload function into module manager

This commit is contained in:
DNx5 2015-10-06 08:08:32 +07:00
parent 3f179ade81
commit 4d4931af3f
3 changed files with 12 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -112,6 +112,11 @@ public class ModuleManager {
return count;
}
public void reloadModules(){
unloadModules();
loadModules();
}
public void unloadModule(String name) {
Iterator<Module> it = modules.iterator();
while (it.hasNext()) {