Separate message for antibot kick

This commit is contained in:
Gabriele C 2015-07-28 00:40:25 +02:00
parent 5388f08117
commit 79e6574232
2 changed files with 18 additions and 3 deletions

View File

@ -428,7 +428,7 @@ public class AuthMePlayerListener implements Listener {
} }
} }
if (Settings.isKickNonRegisteredEnabled) { if (Settings.isKickNonRegisteredEnabled && !Settings.antiBotInAction){
if (!plugin.database.isAuthAvailable(name)) { if (!plugin.database.isAuthAvailable(name)) {
event.setKickMessage(m.send("reg_only")[0]); event.setKickMessage(m.send("reg_only")[0]);
event.setResult(PlayerLoginEvent.Result.KICK_OTHER); event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
@ -436,6 +436,14 @@ public class AuthMePlayerListener implements Listener {
} }
} }
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 // Check if forceSingleSession is set to true, so kick player that has
// joined with same nick of online player // joined with same nick of online player
if (player.isOnline() && Settings.isForceSingleSessionEnabled) { if (player.isOnline() && Settings.isForceSingleSessionEnabled) {

View File

@ -22,6 +22,9 @@ import fr.xephi.authme.security.HashAlgorithm;
public final class Settings extends YamlConfiguration { 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 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 CACHE_FOLDER = Settings.PLUGIN_FOLDER + File.separator + "cache";
public static final String AUTH_FILE = Settings.PLUGIN_FOLDER + File.separator + "auths.db"; 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) { public static void switchAntiBotMod(boolean mode) {
if (mode) if (mode){
isKickNonRegisteredEnabled = true; 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() { private static void getWelcomeMessage() {