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
|
// Initialize and setup the database
|
||||||
public void setupDatabase() throws Exception {
|
public void setupDatabase() throws Exception {
|
||||||
|
if (database != null) database.close();
|
||||||
// Backend MYSQL - FILE - SQLITE - SQLITEHIKARI
|
// Backend MYSQL - FILE - SQLITE - SQLITEHIKARI
|
||||||
boolean isSQLite = false;
|
boolean isSQLite = false;
|
||||||
switch (Settings.getDataSource) {
|
switch (Settings.getDataSource) {
|
||||||
@ -704,6 +705,10 @@ public class AuthMe extends JavaPlugin {
|
|||||||
return count >= Settings.getMaxJoinPerIp;
|
return count >= Settings.getMaxJoinPerIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ModuleManager getModuleManager() {
|
||||||
|
return moduleManager;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Player real IP through VeryGames method
|
* Get Player real IP through VeryGames method
|
||||||
*
|
*
|
||||||
@ -736,5 +741,4 @@ public class AuthMe extends JavaPlugin {
|
|||||||
public String getCountryName(String ip) {
|
public String getCountryName(String ip) {
|
||||||
return Utils.getCountryName(ip);
|
return Utils.getCountryName(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,11 +110,12 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
} else if (args[0].equalsIgnoreCase("reload")) {
|
} else if (args[0].equalsIgnoreCase("reload")) {
|
||||||
try {
|
try {
|
||||||
Settings.reload();
|
Settings.reload();
|
||||||
|
plugin.getModuleManager().reloadModules();
|
||||||
m.reloadMessages();
|
m.reloadMessages();
|
||||||
plugin.database.close();
|
|
||||||
plugin.setupDatabase();
|
plugin.setupDatabase();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!");
|
ConsoleLogger.showError("Fatal error occurred! Authme instance ABORTED!");
|
||||||
|
ConsoleLogger.writeStackTrace(e);
|
||||||
plugin.stopOrUnload();
|
plugin.stopOrUnload();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -112,6 +112,11 @@ public class ModuleManager {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reloadModules(){
|
||||||
|
unloadModules();
|
||||||
|
loadModules();
|
||||||
|
}
|
||||||
|
|
||||||
public void unloadModule(String name) {
|
public void unloadModule(String name) {
|
||||||
Iterator<Module> it = modules.iterator();
|
Iterator<Module> it = modules.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user