This commit is contained in:
Gabriele C 2015-11-24 19:04:18 +01:00
parent cc8401e841
commit 28e742e42f
3 changed files with 18 additions and 20 deletions

View File

@ -1,30 +1,22 @@
package fr.xephi.authme; package fr.xephi.authme;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
/** /**
* The AntiBot Service Management class. * The AntiBot Service Management class.
*/ */
public class AntiBot { public class AntiBot {
public enum AntiBotStatus {
ARMED,
DISARMED,
DELAYED,
ACTIVATED
}
private static AntiBotStatus antiBotStatus = AntiBotStatus.DISARMED;
private static final AuthMe plugin = AuthMe.getInstance(); private static final AuthMe plugin = AuthMe.getInstance();
private static final Messages messages = plugin.getMessages(); private static final Messages messages = plugin.getMessages();
private static final List<String> antibotPlayers = new ArrayList<>(); private static final List<String> antibotPlayers = new ArrayList<>();
private static AntiBotStatus antiBotStatus = AntiBotStatus.DISARMED;
public static void setupAntiBotService() { public static void setupAntiBotService() {
if (!Settings.enableAntiBot) { if (!Settings.enableAntiBot) {
@ -38,11 +30,11 @@ public class AntiBot {
}, 2400); }, 2400);
} }
public static void switchAntiBotStatus(boolean activated) { public static void overrideAntiBotStatus(boolean activated) {
if(antiBotStatus == AntiBotStatus.DISARMED || antiBotStatus == AntiBotStatus.DELAYED) { if (antiBotStatus == AntiBotStatus.DISARMED || antiBotStatus == AntiBotStatus.DELAYED) {
return; return;
} }
if(activated) { if (activated) {
antiBotStatus = AntiBotStatus.ACTIVATED; antiBotStatus = AntiBotStatus.ACTIVATED;
} else { } else {
antiBotStatus = AntiBotStatus.ARMED; antiBotStatus = AntiBotStatus.ARMED;
@ -98,4 +90,11 @@ public class AntiBot {
}, 300); }, 300);
} }
public enum AntiBotStatus {
ARMED,
DISARMED,
DELAYED,
ACTIVATED
}
} }

View File

@ -33,14 +33,14 @@ public class SwitchAntiBotCommand extends ExecutableCommand {
// Enable the mod // Enable the mod
if (newState.equalsIgnoreCase("ON")) { if (newState.equalsIgnoreCase("ON")) {
AntiBot.switchAntiBotStatus(true); AntiBot.overrideAntiBotStatus(true);
sender.sendMessage("[AuthMe] AntiBot Manual Ovverride: enabled!"); sender.sendMessage("[AuthMe] AntiBot Manual Ovverride: enabled!");
return true; return true;
} }
// Disable the mod // Disable the mod
if (newState.equalsIgnoreCase("OFF")) { if (newState.equalsIgnoreCase("OFF")) {
AntiBot.switchAntiBotStatus(false); AntiBot.overrideAntiBotStatus(false);
sender.sendMessage("[AuthMe] AntiBotMod Manual Ovverride: disabled!"); sender.sendMessage("[AuthMe] AntiBotMod Manual Ovverride: disabled!");
return true; return true;
} }

View File

@ -4,7 +4,6 @@ import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSource.DataSourceType; import fr.xephi.authme.datasource.DataSource.DataSourceType;
import fr.xephi.authme.listener.AuthMeInventoryPacketAdapter;
import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.HashAlgorithm;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;