diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 03beb3b6b..5ce3148e1 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -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(m.send("AntiBot service in action! Non registered players can't connect until the bot attack stops!")[0]); //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/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 12b4c6652..6f513f608 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"; @@ -606,9 +609,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() {