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,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

View File

@ -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() {