mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-26 09:31:29 +01:00
added reload function into module manager
This commit is contained in:
parent
3f179ade81
commit
4d4931af3f
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user