diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/forcedActions.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/actions.yml similarity index 100% rename from PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/forcedActions.yml rename to PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/actions.yml diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml index 5493ecd69..a432ec9c3 100644 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml +++ b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/advanced.yml @@ -17,9 +17,6 @@ sessionLogin: sessionExpireOnIpChange: true security: - # Should players in the OP list have every permissions? - opPermissions: true - # Online players aren't kicked out for "Logged in from another location!", this option should always be set to true! forceSingleSession: true # Should we display all other accounts from a player when he joins? diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml index 6a8855997..6c26091b4 100644 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml +++ b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/database.yml @@ -1,7 +1,6 @@ # Database AuthMeReloaded configuration file # What type of database do you want to use? Avariable options: sqlite, mysql, redis -# (The old flatfile backend is now deprecated, if you set this option to 'file' the 'file to SQLite' converter will be executed!) backend: sqlite # Do you like to cache all the queries? (Performance Boost) caching: true @@ -12,6 +11,7 @@ databaseName: authme tableName: authme # MySql Database connection settings +# Avariable only if the AuthMeReloaded-Mysql module is installed! mysql: port: '3306' host: 127.0.0.1 @@ -19,6 +19,7 @@ mysql: password: '12345' # Redis Database connection settings +# Avariable only if the AuthMeReloaded-Redis module is installed! redis: # Get Redis from http://redis.io/ host: 127.0.0.1 diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/emailSystem.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/email.yml similarity index 100% rename from PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/emailSystem.yml rename to PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/email.yml diff --git a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml index c1d290c2c..48931ea49 100644 --- a/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml +++ b/PROTOTYPE AREA (future stuff and etc...)/NewConfiguration/general.yml @@ -67,8 +67,6 @@ password: # When it's true, registration require that kind of command: # /register doublePasswordCheck: true - # Should players can use their usernames as passwords? - allowNameAsPassword: false # Deny unsafe passwords for being used, put them on lowercase! unsafePasswords: - '123456' diff --git a/README.md b/README.md index 6468c75d0..12216e738 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -
-

+

The most used authentication plugin for CraftBukkit/Spigot!


#####Development tools: @@ -14,7 +13,7 @@ - JavaDocs: AuthMe Javadoc -- Maven Repo: AuthMe Repo +- Maven Repo: AuthMe Repo #####Statistics: @@ -39,7 +38,7 @@ McStats: http://mcstats.org/plugin/AuthMe #####Running Requirements: >- Java 1.7 (should work also with Java 1.8) ->- Spigot or CraftBukkit +>- Spigot or CraftBukkit (1.7.10 or 1.8.X)
###Plugin Description: @@ -60,7 +59,7 @@ typing commands or use the inventory. It can also kick players with uncommon lon
  • Username spoofing protection.
  • Countries Whitelist/Blacklist! (countries codes)
  • Built-in AntiBot System!
  • -
  • Passpartu Feature: Admin can login with all account more info here (Deprecated)
  • +
  • ForceLogin Feature: Admins can login with all account via console command!
  • Avoid the "Logged in from another location" message!
  • Session Login!
  • Editable translations and messages!
  • diff --git a/pom.xml b/pom.xml index 913e8b36e..316384fb9 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.7 - 1.8.7-R0.1-SNAPSHOT + 1.8.8-R0.1-SNAPSHOT @@ -178,6 +178,7 @@ mysql mysql-connector-java 5.1.36 + compile @@ -185,6 +186,7 @@ org.xerial sqlite-jdbc 3.8.10.1 + compile @@ -192,13 +194,16 @@ com.sun.mail javax.mail 1.5.4 + compile + com.maxmind.geoip geoip-api 1.2.14 + compile @@ -224,6 +229,7 @@ org.spigotmc spigot-api ${bukkitVersion} + provided bungeecord-chat @@ -237,6 +243,7 @@ com.comphenix.attribute AttributeStorage 0.0.2-SNAPSHOT + compile org.bukkit @@ -272,6 +279,7 @@ net.citizensnpcs citizensapi 2.0.16-SNAPSHOT + provided org.bukkit @@ -290,7 +298,7 @@ Multiverse-Core 2.5 jar - compile + provided org.bukkit @@ -320,6 +328,7 @@ net.ess3 Essentials 2.14-SNAPSHOT + provided org.bukkit @@ -337,6 +346,7 @@ net.minelink CombatTagPlus 1.2.1-SNAPSHOT + provided org.bukkit @@ -410,6 +420,7 @@ com.trc202 CombatTag 6.2.1-SNAPSHOT + provided org.bukkit @@ -427,6 +438,7 @@ de.luricos.bukkit xAuth 2.6 + provided org.bukkit @@ -464,6 +476,7 @@ com.acrobot.chestshop chestshop 3.8.12 + provided org.bukkit diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 45a6052ec..f320e5b5f 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -49,7 +49,6 @@ import fr.xephi.authme.commands.ConverterCommand; import fr.xephi.authme.commands.EmailCommand; import fr.xephi.authme.commands.LoginCommand; import fr.xephi.authme.commands.LogoutCommand; -import fr.xephi.authme.commands.PasspartuCommand; import fr.xephi.authme.commands.RegisterCommand; import fr.xephi.authme.commands.UnregisterCommand; import fr.xephi.authme.converter.Converter; @@ -243,7 +242,6 @@ public class AuthMe extends JavaPlugin { this.getCommand("changepassword").setExecutor(new ChangePasswordCommand(this)); this.getCommand("logout").setExecutor(new LogoutCommand(this)); this.getCommand("unregister").setExecutor(new UnregisterCommand(this)); - this.getCommand("passpartu").setExecutor(new PasspartuCommand(this)); this.getCommand("email").setExecutor(new EmailCommand(this)); this.getCommand("captcha").setExecutor(new CaptchaCommand(this)); this.getCommand("converter").setExecutor(new ConverterCommand(this)); @@ -251,8 +249,12 @@ public class AuthMe extends JavaPlugin { if (!Settings.isForceSingleSessionEnabled) { ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!"); } + + if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) { + ConsoleLogger.showError("WARNING!!! You set session timeout to 0, this may cause security issues!"); + } - if (Settings.reloadSupport) + if (Settings.reloadSupport) { try { int playersOnline = 0; try { @@ -277,9 +279,9 @@ public class AuthMe extends JavaPlugin { } } catch (Exception ex) { } + } - if (Settings.usePurge) - autoPurge(); + autoPurge(); // Download GeoIp.dat file downloadGeoIp(); @@ -543,13 +545,13 @@ public class AuthMe extends JavaPlugin { return; ConsoleLogger.info("AutoPurging the Database: " + cleared.size() + " accounts removed!"); if (Settings.purgeEssentialsFile && this.ess != null) - dataManager.purgeEssentials(cleared); + dataManager.purgeEssentials(cleared); // name to UUID convertion needed with latest versions if (Settings.purgePlayerDat) - dataManager.purgeDat(cleared); + dataManager.purgeDat(cleared); // name to UUID convertion needed with latest versions of MC if (Settings.purgeLimitedCreative) dataManager.purgeLimitedCreative(cleared); if (Settings.purgeAntiXray) - dataManager.purgeAntiXray(cleared); + dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or names... (Actually it purges only names!) if (Settings.purgePermissions) dataManager.purgePermissions(cleared, permission); } diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 2bcfa17aa..072d97416 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -109,6 +109,12 @@ public class DataManager { if (playerFile.exists()) { playerFile.delete(); i++; + } else { + playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat"); + if (playerFile.exists()) { + playerFile.delete(); + i++; + } } } catch (Exception e) { } @@ -116,6 +122,7 @@ public class DataManager { ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " .dat Files"); } + @SuppressWarnings("deprecation") public void purgeEssentials(List cleared) { int i = 0; for (String name : cleared) { @@ -124,6 +131,12 @@ public class DataManager { if (playerFile.exists()) { playerFile.delete(); i++; + } else { + playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + Bukkit.getOfflinePlayer(name).getUniqueId() + ".yml"); + if (playerFile.exists()) { + playerFile.delete(); + i++; + } } } catch (Exception e) { } diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 40056e337..d7681ade8 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -82,25 +82,40 @@ public class SendMailSSL { // Generate an image ? File file = null; if (Settings.generateImage) { - ImageGenerator gen = new ImageGenerator(newPass); - file = new File(plugin.getDataFolder() + File.separator + auth.getNickname() + "_new_pass.jpg"); - ImageIO.write(gen.generateImage(), "jpg", file); - messageBodyPart = new MimeBodyPart(); - DataSource source = new FileDataSource(file); - messageBodyPart.setDataHandler(new DataHandler(source)); - messageBodyPart.setFileName(auth.getNickname() + "_new_pass.jpg"); - multipart.addBodyPart(messageBodyPart); + try { + ImageGenerator gen = new ImageGenerator(newPass); + file = new File(plugin.getDataFolder() + File.separator + auth.getNickname() + "_new_pass.jpg"); + ImageIO.write(gen.generateImage(), "jpg", file); + messageBodyPart = new MimeBodyPart(); + DataSource source = new FileDataSource(file); + messageBodyPart.setDataHandler(new DataHandler(source)); + messageBodyPart.setFileName(auth.getNickname() + "_new_pass.jpg"); + multipart.addBodyPart(messageBodyPart); + } catch (Exception e) { + ConsoleLogger.showError("Unable to send new password as image! Using normal text! Dest: " + mail); + } } - - message.setContent(multipart); + Transport transport = session.getTransport("smtp"); - transport.connect(smtp, acc, password); + message.setContent(multipart); + + try { + transport.connect(smtp, acc, password); + } catch (Exception e) { + ConsoleLogger.showError("Can't connect to your SMTP server! Aborting! Can't send recorvery email to " + mail); + if (file != null) + file.delete(); + return; + } transport.sendMessage(message, message.getAllRecipients()); + if (file != null) file.delete(); + } catch (RuntimeException e) { + ConsoleLogger.showError("Some error occured while trying to send a email to " + mail); } catch (Exception e) { - ConsoleLogger.showError("Some error occured while trying to send a mail to " + mail); + ConsoleLogger.showError("Some error occured while trying to send a email to " + mail); } } diff --git a/src/main/java/fr/xephi/authme/Utils.java b/src/main/java/fr/xephi/authme/Utils.java index 15e01fe22..c19754868 100644 --- a/src/main/java/fr/xephi/authme/Utils.java +++ b/src/main/java/fr/xephi/authme/Utils.java @@ -1,8 +1,7 @@ package fr.xephi.authme; -import java.util.ArrayList; +import java.io.File; import java.util.Iterator; -import java.util.List; import org.bukkit.Bukkit; import org.bukkit.GameMode; @@ -13,7 +12,6 @@ import org.bukkit.entity.Player; import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.events.AuthMeTeleportEvent; -import fr.xephi.authme.security.RandomString; import fr.xephi.authme.settings.Settings; public class Utils { @@ -22,7 +20,6 @@ public class Utils { private static Utils singleton; int id; public AuthMe plugin; - private static List tokens = new ArrayList(); public Utils(AuthMe plugin) { this.plugin = plugin; @@ -160,40 +157,6 @@ public class Utils { }); } - /* - * Random Token for passpartu - */ - public boolean obtainToken() { - try { - final String token = new RandomString(10).nextString(); - tokens.add(token); - ConsoleLogger.info("[AuthMe] Security passpartu token: " + token); - Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - tokens.remove(token); - } - - }, 600); - return true; - } catch (Exception e) { - e.printStackTrace(); - } - return false; - } - - /* - * Read Token - */ - public boolean readToken(String inputToken) { - boolean ret = false; - if (tokens.contains(inputToken)) - ret = true; - tokens.remove(inputToken); - return (ret); - } - /* * Used for force player GameMode */ @@ -208,5 +171,19 @@ public class Utils { NOTLOGGEDIN, LOGGEDIN } - + + public static void purgeDirectory(File file){ + String files[] = file.list(); + if (files != null && files.length != 0){ + for (String temp : files) { + File fileDelete = new File(file, temp); + if (fileDelete.isDirectory()){ + purgeDirectory(fileDelete); + fileDelete.delete(); + } else { + fileDelete.delete(); + } + } + } + } } diff --git a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java index 11fce587c..b18ad9c16 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/FileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/FileCache.java @@ -24,6 +24,7 @@ import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.api.API; import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.Utils; public class FileCache { @@ -44,9 +45,9 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); @@ -197,9 +198,9 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } try { File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); @@ -536,30 +537,25 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } try { File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path); - if (!file.exists()) { - file = new File("cache/" + player.getName().toLowerCase() + ".cache"); - } - if (file.exists()) { - if (file.isDirectory() && file.listFiles() != null) { - for (File f : file.listFiles()) { - if (f.isDirectory() && f.listFiles() != null) { - for (File a : f.listFiles()) { - a.delete(); - } - f.delete(); - } else f.delete(); - } + if (file.list() != null) { + Utils.purgeDirectory(file); + file.delete(); + } else { + file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + player.getName().toLowerCase() + ".cache"); + if(file.isFile()){ file.delete(); - } else file.delete(); + } else { + ConsoleLogger.showError("Failed to remove" + player.getName() + "cache, it doesn't exist!"); + } } } catch (Exception e) { - ConsoleLogger.showError("File cannot be removed correctly :/"); + ConsoleLogger.showError("Failed to remove" + player.getName() + "cache :/"); } } @@ -568,9 +564,9 @@ public class FileCache { try { path = player.getUniqueId().toString(); } catch (Exception e) { - path = player.getName(); + path = player.getName().toLowerCase(); } catch (Error e) { - path = player.getName(); + path = player.getName().toLowerCase(); } File file = new File(plugin.getDataFolder() + File.separator + "cache" + File.separator + path + File.separator + "playerdatas.cache"); if (!file.exists()) { diff --git a/src/main/java/fr/xephi/authme/commands/AdminCommand.java b/src/main/java/fr/xephi/authme/commands/AdminCommand.java index 1f6a15efe..10a4e950e 100644 --- a/src/main/java/fr/xephi/authme/commands/AdminCommand.java +++ b/src/main/java/fr/xephi/authme/commands/AdminCommand.java @@ -15,7 +15,6 @@ import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; @@ -71,7 +70,6 @@ public class AdminCommand implements CommandExecutor { sender.sendMessage("/authme firstspawn - Teleport yourself to the first spawn point"); sender.sendMessage("/authme switchantibot on/off - Enable/Disable AntiBot feature"); sender.sendMessage("/authme forcelogin - Enforce the login of a connected player"); - sender.sendMessage("/authme passpartutoken - Generate a timed token to login with every player's account (CONSOLE ONLY)"); return true; } @@ -80,19 +78,6 @@ public class AdminCommand implements CommandExecutor { return true; } - if ((sender instanceof ConsoleCommandSender) && args[0].equalsIgnoreCase("passpartutoken")) { - if (args.length > 1) { - ConsoleLogger.info("[AuthMe] command usage: /authme passpartutoken"); - return true; - } - if (Utils.getInstance().obtainToken()) { - ConsoleLogger.info("[AuthMe] You have 30s to insert this token ingame with /passpartu "); - } else { - ConsoleLogger.info("[AuthMe] Security error on passpartu token, please redo the command."); - } - return true; - } - if (args[0].equalsIgnoreCase("version")) { sender.sendMessage("AuthMe Version: " + AuthMe.getInstance().getDescription().getVersion()); return true; diff --git a/src/main/java/fr/xephi/authme/commands/PasspartuCommand.java b/src/main/java/fr/xephi/authme/commands/PasspartuCommand.java deleted file mode 100644 index 0d7b059e9..000000000 --- a/src/main/java/fr/xephi/authme/commands/PasspartuCommand.java +++ /dev/null @@ -1,52 +0,0 @@ -package fr.xephi.authme.commands; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.Utils; -import fr.xephi.authme.cache.auth.PlayerCache; -import fr.xephi.authme.settings.Messages; - -/** - * - * @author stefano - */ -public class PasspartuCommand implements CommandExecutor { - - private Utils utils = Utils.getInstance(); - public AuthMe plugin; - private Messages m = Messages.getInstance(); - - public PasspartuCommand(AuthMe plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmnd, String label, - String[] args) { - - if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) { - m.send(sender, "no_perm"); - return true; - } - - if (PlayerCache.getInstance().isAuthenticated(sender.getName().toLowerCase())) { - return true; - } - - if ((sender instanceof Player) && args.length == 1) { - if (utils.readToken(args[0])) { - // bypass login! - plugin.management.performLogin((Player) sender, "dontneed", true); - return true; - } - sender.sendMessage("Time is expired or Token is Wrong!"); - return true; - } - sender.sendMessage("usage: /passpartu token"); - return true; - } -} diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 03beb3b6b..7f7c19c6f 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -84,7 +84,7 @@ public class AuthMePlayerListener implements Listener { return; String cmd = msg.split(" ")[0]; - if (cmd.equalsIgnoreCase("/login") || cmd.equalsIgnoreCase("/register") || cmd.equalsIgnoreCase("/passpartu") || cmd.equalsIgnoreCase("/l") || cmd.equalsIgnoreCase("/reg") || cmd.equalsIgnoreCase("/email") || cmd.equalsIgnoreCase("/captcha")) + if (cmd.equalsIgnoreCase("/login") || cmd.equalsIgnoreCase("/register") || cmd.equalsIgnoreCase("/l") || cmd.equalsIgnoreCase("/reg") || cmd.equalsIgnoreCase("/email") || cmd.equalsIgnoreCase("/captcha")) return; if (Settings.useEssentialsMotd && cmd.equalsIgnoreCase("/motd")) return; @@ -411,7 +411,7 @@ public class AuthMePlayerListener implements Listener { if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) return; - if (Settings.enablePasspartu && !Settings.countriesBlacklist.isEmpty()) { + if (!Settings.countriesBlacklist.isEmpty()) { String code = plugin.getCountryCode(event.getAddress().getHostAddress()); if (((code == null) || (Settings.countriesBlacklist.contains(code) && !isAuthAvailable)) && !plugin.authmePermissible(player, "authme.bypassantibot")) { event.setKickMessage(m.send("country_banned")[0]); @@ -428,13 +428,21 @@ public class AuthMePlayerListener implements Listener { } } - if (Settings.isKickNonRegisteredEnabled) { + if (Settings.isKickNonRegisteredEnabled && !Settings.antiBotInAction){ if (!plugin.database.isAuthAvailable(name)) { event.setKickMessage(m.send("reg_only")[0]); event.setResult(PlayerLoginEvent.Result.KICK_OTHER); return; } } + + if (Settings.antiBotInAction){ + if (!plugin.database.isAuthAvailable(name)) { + event.setKickMessage("AntiBot service in action! Non registered players can't connect until the bot attack stops!"); //Need to add string to messages + event.setResult(PlayerLoginEvent.Result.KICK_OTHER); + return; + } + } // Check if forceSingleSession is set to true, so kick player that has // joined with same nick of online player diff --git a/src/main/java/fr/xephi/authme/modules/Module.java b/src/main/java/fr/xephi/authme/modules/Module.java index 779beb65e..6011097af 100644 --- a/src/main/java/fr/xephi/authme/modules/Module.java +++ b/src/main/java/fr/xephi/authme/modules/Module.java @@ -13,6 +13,7 @@ public interface Module { public enum ModuleType { MANAGER, MYSQL, + REDIS, ACTIONS, CONVERTERS, EMAILS, diff --git a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java index 7e5101d0b..2e72bde46 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsyncronousJoin.java @@ -141,7 +141,7 @@ public class AsyncronousJoin { SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { - if (player != null && player.isOnline() && tpEvent.getTo() != null) { + if (player.isOnline() && tpEvent.getTo() != null) { if (tpEvent.getTo().getWorld() != null) player.teleport(tpEvent.getTo()); } @@ -185,7 +185,7 @@ public class AsyncronousJoin { SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name)); plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { - if (player != null && player.isOnline() && tpEvent.getTo() != null) { + if (player.isOnline() && tpEvent.getTo() != null) { if (tpEvent.getTo().getWorld() != null) player.teleport(tpEvent.getTo()); } @@ -291,7 +291,7 @@ public class AsyncronousJoin { FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), loc); plugin.getServer().getPluginManager().callEvent(tpEvent); if (!tpEvent.isCancelled()) { - if (player != null && player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { + if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) { player.teleport(tpEvent.getTo()); } } diff --git a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java index 4c833d66b..e60d9719e 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsyncronousQuit.java @@ -78,18 +78,20 @@ public class AsyncronousQuit { LimboCache.getInstance().deleteLimboPlayer(name); } if (Settings.isSessionsEnabled && !isKick) { - BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { - - @Override - public void run() { - PlayerCache.getInstance().removePlayer(name); - if (database.isLogged(name)) - database.setUnlogged(name); - plugin.sessions.remove(name); - } - - }, Settings.getSessionTimeout * 20 * 60); - plugin.sessions.put(name, task); + if (Settings.getSessionTimeout != 0){ + BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + + @Override + public void run() { + PlayerCache.getInstance().removePlayer(name); + if (database.isLogged(name)) + database.setUnlogged(name); + plugin.sessions.remove(name); + } + + }, Settings.getSessionTimeout * 20 * 60); + plugin.sessions.put(name, task); + } } else { PlayerCache.getInstance().removePlayer(name); database.setUnlogged(name); diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java index e7510eae0..96a200c23 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java @@ -1,13 +1,14 @@ package fr.xephi.authme.process.register; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.Utils; import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.task.MessageTask; @@ -28,21 +29,26 @@ public class ProcessSyncronousEmailRegister implements Runnable { @Override public void run() { + LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); if (!Settings.getRegisteredGroup.isEmpty()) { Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED); } m.send(player, "vb_nonActiv"); int time = Settings.getRegistrationTimeout * 20; int msgInterval = Settings.getWarnMessageInterval; - if (time != 0) { - LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel(); - BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); - LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); + + BukkitScheduler sched = plugin.getServer().getScheduler(); + if (time != 0 && limbo != null) { + limbo.getTimeoutTaskId().cancel(); + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time); + limbo.setTimeoutTaskId(id); + } + if (limbo != null){ + limbo.getMessageTaskId().cancel(); + BukkitTask nwMsg = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); + limbo.setMessageTaskId(nwMsg); } - LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel(); - BukkitTask nwMsg = Bukkit.getScheduler().runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval)); - LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg); player.saveData(); if (!Settings.noConsoleSpam) ConsoleLogger.info(player.getName() + " registered " + plugin.getIP(player)); diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 12b4c6652..6fc1aca6f 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -22,6 +22,9 @@ import fr.xephi.authme.security.HashAlgorithm; public final class Settings extends YamlConfiguration { + //This is not an option! + public static Boolean antiBotInAction = false; + public static String PLUGIN_FOLDER = "." + File.separator + "plugins" + File.separator + "AuthMe"; public static final String CACHE_FOLDER = Settings.PLUGIN_FOLDER + File.separator + "cache"; public static final String AUTH_FILE = Settings.PLUGIN_FOLDER + File.separator + "auths.db"; @@ -59,7 +62,7 @@ public final class Settings extends YamlConfiguration { isResetInventoryIfCreative, isCachingEnabled, isKickOnWrongPasswordEnabled, getEnablePasswordVerifier, protectInventoryBeforeLogInEnabled, isBackupActivated, - isBackupOnStart, isBackupOnStop, enablePasspartu, isStopEnabled, + isBackupOnStart, isBackupOnStop, isStopEnabled, reloadSupport, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts, useCaptcha, emailRegistration, multiverse, chestshop, bungee, banUnsafeIp, doubleEmailCheck, @@ -184,7 +187,6 @@ public final class Settings extends YamlConfiguration { isBackupOnStart = configFile.getBoolean("BackupSystem.OnServerStart", false); isBackupOnStop = configFile.getBoolean("BackupSystem.OnServeStop", false); backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"); - enablePasspartu = configFile.getBoolean("Passpartu.enablePasspartu", false); isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true); reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true); allowCommands = (List) configFile.getList("settings.restrictions.allowCommands"); @@ -197,8 +199,6 @@ public final class Settings extends YamlConfiguration { allowCommands.add("/l"); if (!allowCommands.contains("/reg")) allowCommands.add("/reg"); - if (!allowCommands.contains("/passpartu")) - allowCommands.add("/passpartu"); if (!allowCommands.contains("/email")) allowCommands.add("/email"); if (!allowCommands.contains("/captcha")) @@ -417,8 +417,16 @@ public final class Settings extends YamlConfiguration { } if (contains("Performances.useMultiThreading")) set("Performances.useMultiThreading", null); + if (contains("Performances")) set("Performances", null); + + if (contains("Passpartu.enablePasspartu")) + set("Passpartu.enablePasspartu", null); + + if (contains("Passpartu")) + set("Passpartu", null); + if (!contains("Email.emailWhitelisted")) { set("Email.emailWhitelisted", new ArrayList()); changes = true; @@ -606,9 +614,13 @@ public final class Settings extends YamlConfiguration { } public static void switchAntiBotMod(boolean mode) { - if (mode) + if (mode){ isKickNonRegisteredEnabled = true; - else isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false); + antiBotInAction = true; + }else{ + isKickNonRegisteredEnabled = configFile.getBoolean("settings.restrictions.kickNonRegistered", false); + antiBotInAction = false; + } } private static void getWelcomeMessage() { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 0475c055c..b98ce8514 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -84,7 +84,6 @@ settings: - /register - /l - /reg - - /passpartu - /email - /captcha # Maximum Registration per IP default: 1 @@ -305,13 +304,6 @@ BackupSystem: OnServerStop: true # Windows only mysql installation Path MysqlWindowsPath: 'C:\\Program Files\\MySQL\\MySQL Server 5.1\\' -Passpartu: - # Enable or Disable Passpartu Feature, - # this feature let Admin Login with all registered - # Account they need, for example inspecting Player that - # is doing shit, they can login without know any - # Player password! More info on How TO - enablePasspartu: false Security: SQLProblem: # Stop the server if we can't contact the sql database diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c0bd7fb44..5028d2550 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -22,10 +22,7 @@ commands: usage: /logout unregister: description: unregister your account - usage: /unregister password - passpartu: - description: compare passpartu token - usage: /passpartu token + usage: /unregister password authme: description: AuthMe op commands usage: '/authme reload|register playername password|changepassword playername password|unregister playername|version' @@ -48,7 +45,6 @@ permissions: authme.changepassword: true authme.logout: true authme.unregister: true - authme.passpartu: true authme.l: true authme.reg: true authme.email: true @@ -87,9 +83,6 @@ permissions: authme.email: description: Email default: true - authme.passpartu: - description: passpartu - default: true authme.allow2accounts: description: allow more accounts for same ip default: false diff --git a/team.txt b/team.txt index c67b6f0c5..21b9cdb46 100644 --- a/team.txt +++ b/team.txt @@ -2,9 +2,10 @@ AuthMe-Team: Xephi (Xephi59) - Leader, Main developer darkwarriors (d4rkwarriors) - Old AuthMe Reloaded Author +Kloudy - Main developer Gabriele C. (sgdc3) - Ticket Manager, Project Page and Structure Manager, Contributor -Maxetto (maxetto) - Ticket Manager, Italian Translator, Basic Developer -Trojaner25 (Trojaner25) - Ticket manager, Basic Developer -irobin591 (irobin591) - DE Translator -WaterCXubic (WaterXCubic) - ZHHK Translator +Maxetto - Ticket Manager, Italian Translator, Basic Developer, Contributor +Trojaner25 - Ticket manager, Basic Developer +irobin591 - DE Translator +WaterCXubic - ZHHK Translator Bodyash - Russian/Ukrainian translator