diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 69ecd90..2976d81 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -1,9 +1,5 @@ package fr.xephi.authme; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; import java.util.Calendar; import java.util.Collection; import java.util.Date; @@ -56,7 +52,6 @@ import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.listener.AuthMePlayerListener16; import fr.xephi.authme.listener.AuthMePlayerListener18; import fr.xephi.authme.listener.AuthMeServerListener; -import fr.xephi.authme.modules.ModuleManager; import fr.xephi.authme.plugin.manager.BungeeCordMessage; import fr.xephi.authme.plugin.manager.EssSpawn; import fr.xephi.authme.process.Management; @@ -93,8 +88,6 @@ public class AuthMe extends JavaPlugin { private Logger authmeLogger; private Messages m; - // Module manager - private ModuleManager moduleManager; private JsonCache playerBackup; private Settings settings; @@ -204,11 +197,6 @@ public class AuthMe extends JavaPlugin { ip = realIp.get(name); } } - if (Settings.checkVeryGames) { - if (getVeryGamesIP(player) != null) { - ip = getVeryGamesIP(player); - } - } return ip; } @@ -216,10 +204,6 @@ public class AuthMe extends JavaPlugin { return m; } - public ModuleManager getModuleManager() { - return moduleManager; - } - public Settings getSettings() { return settings; } @@ -247,30 +231,6 @@ public class AuthMe extends JavaPlugin { return spawnLoc; } - /** - * Get Player real IP through VeryGames method - * - * @param player - * player - */ - @Deprecated - public String getVeryGamesIP(final Player player) { - String realIP = player.getAddress().getAddress().getHostAddress(); - String sUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%"; - sUrl = sUrl.replace("%IP%", player.getAddress().getAddress().getHostAddress()).replace("%PORT%", "" + player.getAddress().getPort()); - try { - final URL url = new URL(sUrl); - final URLConnection urlc = url.openConnection(); - final BufferedReader in = new BufferedReader(new InputStreamReader(urlc.getInputStream())); - final String inputLine = in.readLine(); - if (inputLine != null && !inputLine.isEmpty() && !inputLine.equalsIgnoreCase("error") && !inputLine.contains("error")) { - realIP = inputLine; - } - } catch (final Exception ignored) { - } - return realIP; - } - public boolean hasJoinedIp(final String name, final String ip) { int count = 0; for (final Player player : Utils.getOnlinePlayers()) { @@ -316,9 +276,6 @@ public class AuthMe extends JavaPlugin { } } - // Unload modules - moduleManager.unloadModules(); - // Disabled correctly ConsoleLogger.info("AuthMe " + this.getDescription().getVersion() + " 已卸载!"); } @@ -331,12 +288,6 @@ public class AuthMe extends JavaPlugin { authmeLogger = Logger.getLogger("AuthMe"); authme = this; - // TODO: split the plugin in more modules - moduleManager = new ModuleManager(this); - @SuppressWarnings("unused") - final int loaded = moduleManager.loadModules(); - - // TODO: remove vault as hard dependency final PluginManager pm = server.getPluginManager(); // Setup the Logger diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 33ae770..10a1909 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -114,7 +114,6 @@ public class AdminCommand implements CommandExecutor { } else if (args[0].equalsIgnoreCase("reload")) { try { Settings.reload(); - plugin.getModuleManager().reloadModules(); m.reloadMessages(); plugin.setupDatabase(); } catch (final Exception e) { diff --git a/src/main/java/fr/xephi/authme/modules/Module.java b/src/main/java/fr/xephi/authme/modules/Module.java deleted file mode 100644 index 00cc68a..0000000 --- a/src/main/java/fr/xephi/authme/modules/Module.java +++ /dev/null @@ -1,24 +0,0 @@ -package fr.xephi.authme.modules; - -public abstract class Module { - - public abstract String getName(); - - public abstract ModuleType getType(); - - public void load() { - } - - public void unload() { - } - - enum ModuleType { - ACTIONS, - CONVERTERS, - CUSTOM, - EMAILS, - MANAGER, - MYSQL, - REDIS - } -} diff --git a/src/main/java/fr/xephi/authme/modules/ModuleManager.java b/src/main/java/fr/xephi/authme/modules/ModuleManager.java deleted file mode 100644 index 181cbbd..0000000 --- a/src/main/java/fr/xephi/authme/modules/ModuleManager.java +++ /dev/null @@ -1,140 +0,0 @@ -package fr.xephi.authme.modules; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.settings.Settings; - -public class ModuleManager { - - private List modules = new ArrayList<>(); - - public ModuleManager(AuthMe plugin) { - } - - public Module getModule(Module.ModuleType type) { - for (Module m : modules) { - if (m.getType() == type) - return m; - } - return null; - } - - public Module getModule(String name) { - for (Module m : modules) { - if (m.getName().equalsIgnoreCase(name)) - return m; - } - return null; - } - - public boolean isModuleEnabled(Module.ModuleType type) { - for (Module m : modules) { - if (m.getType() == type) - return true; - } - return false; - } - - public boolean isModuleEnabled(String name) { - for (Module m : modules) { - if (m.getName().equalsIgnoreCase(name)) - return true; - } - return false; - } - - public int loadModules() { - File dir = Settings.MODULE_FOLDER; - int count = 0; - if (!dir.isDirectory()) { - dir.mkdirs(); - return count; - } - - File[] files = dir.listFiles(); - if (files == null) { - return count; - } - for (File pathToJar : files) { - JarFile jarFile = null; - URLClassLoader cl = null; - try { - jarFile = new JarFile(pathToJar); - URL[] urls = { new URL("jar:file:" + pathToJar.getAbsolutePath() + "!/") }; - cl = URLClassLoader.newInstance(urls); - - Enumeration e = jarFile.entries(); - while (e.hasMoreElements()) { - JarEntry je = (JarEntry) e.nextElement(); - if (je.isDirectory() || !je.getName().endsWith("Main.class")) { - continue; - } - String className = je.getName().substring(0, je.getName().length() - 6); - className = className.replace('/', '.'); - Class c = cl.loadClass(className); - if (!Module.class.isAssignableFrom(c)) { - continue; - } - - Module mod = (Module) c.newInstance(); - mod.load(); - modules.add(mod); - count++; - break; - } - - } catch (Exception ex) { - ConsoleLogger.writeStackTrace(ex); - ConsoleLogger.showError("Cannot load " + pathToJar.getName() + " jar file !"); - } finally { - try { - if (jarFile != null) { - jarFile.close(); - } - if (cl != null) { - cl.close(); - } - } catch (IOException ignored) { - } - } - } - return count; - } - - public void reloadModules() { - unloadModules(); - loadModules(); - } - - public void unloadModule(String name) { - Iterator it = modules.iterator(); - while (it.hasNext()) { - Module m = it.next(); - if (m.getName().equalsIgnoreCase(name)) { - m.unload(); - it.remove(); - return; - } - } - } - - public void unloadModules() { - Iterator it = modules.iterator(); - while (it.hasNext()) { - it.next().unload(); - it.remove(); - } - } - -} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d024ac8..3334f3e 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -188,9 +188,6 @@ settings: # AuthMe will update the password to the new passwordHash ! supportOldPasswordHash: false # Cancel unsafe passwords for being used, put them on lowercase! - #unsafePasswords: - #- '123456' - #- 'password' unsafePasswords: - '123456' - 'password' @@ -386,6 +383,3 @@ Protection: antiBotSensibility: 5 # Duration in minutes of the antibot automatic system antiBotDuration: 10 -VeryGames: - # These features are only available on VeryGames Server Provider - enableIpCheck: false