diff --git a/src/main/java/net/gravitydevelopment/anticheat/command/executors/CommandCheck.java b/src/main/java/net/gravitydevelopment/anticheat/command/executors/CommandCheck.java index 2bfc0d1..3219c55 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/command/executors/CommandCheck.java +++ b/src/main/java/net/gravitydevelopment/anticheat/command/executors/CommandCheck.java @@ -23,6 +23,8 @@ import net.gravitydevelopment.anticheat.command.CommandBase; import net.gravitydevelopment.anticheat.util.Permission; import org.bukkit.command.CommandSender; +import java.util.List; + public class CommandCheck extends CommandBase { private static final String NAME = "AntiCheat Check Management"; @@ -72,8 +74,16 @@ public class CommandCheck extends CommandBase { } else { if (newValue) { CHECK_MANAGER.activateCheck(type, cs.getName()); + List checks = CONFIG.getConfig().disabledChecks.getValue(); + if (checks.contains(type.toString())) { + checks.remove(type.toString()); + CONFIG.getConfig().disabledChecks.setValue(checks); + } } else { CHECK_MANAGER.deactivateCheck(type, cs.getName()); + List checks = CONFIG.getConfig().disabledChecks.getValue(); + checks.add(type.toString()); + CONFIG.getConfig().disabledChecks.setValue(checks); } cs.sendMessage(GREEN + type.toString() + strValue + "."); } diff --git a/src/main/java/net/gravitydevelopment/anticheat/config/files/Config.java b/src/main/java/net/gravitydevelopment/anticheat/config/files/Config.java index 127f376..145a4c3 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/config/files/Config.java +++ b/src/main/java/net/gravitydevelopment/anticheat/config/files/Config.java @@ -54,6 +54,7 @@ public class Config extends ConfigurationFile { public ConfigValue logToFile; public ConfigValue> disabledWorlds; + public ConfigValue> disabledChecks; public Config(AntiCheat plugin, Configuration config) { super(plugin, config, FILENAME); @@ -88,5 +89,6 @@ public class Config extends ConfigurationFile { logToFile = new ConfigValue("system.log-to-file"); disabledWorlds = new ConfigValue>("disable-in"); + disabledChecks = new ConfigValue>("disabled-checks"); } } diff --git a/src/main/java/net/gravitydevelopment/anticheat/manage/CheckManager.java b/src/main/java/net/gravitydevelopment/anticheat/manage/CheckManager.java index 2b9ec08..8442438 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/manage/CheckManager.java +++ b/src/main/java/net/gravitydevelopment/anticheat/manage/CheckManager.java @@ -39,12 +39,19 @@ public class CheckManager { private Configuration config; private static List checkIgnoreList = new ArrayList(); private static Map> exemptList = new HashMap>(); - private static int disabled = 0; - private static int exempt = 0; public CheckManager(AntiCheatManager manager) { this.manager = manager; this.config = manager.getConfiguration(); + + for (String string : config.getConfig().disabledChecks.getValue()) { + for (CheckType type : CheckType.values()) { + if (type.toString().equalsIgnoreCase(string)) { + checkIgnoreList.add(type); + break; + } + } + } } /** @@ -68,7 +75,6 @@ public class CheckManager { if (isActive(type)) { manager.getLoggingManager().logFineInfo("The " + type.toString() + " check was deactivated by " + className + "."); checkIgnoreList.add(type); - disabled++; } } @@ -95,7 +101,6 @@ public class CheckManager { } manager.getLoggingManager().logFineInfo(player.getName() + " was exempted from the " + type.toString() + " check by " + className + "."); exemptList.get(player.getName()).add(type); - exempt++; } } @@ -187,26 +192,4 @@ public class CheckManager { } return false; } - - /** - * Get the number of exempt players - * - * @return exempt players - */ - public int getExempt() { - int x = exempt; - exempt = 0; - return x; - } - - /** - * Get the number of disabled checks - * - * @return disabled checks - */ - public int getDisabled() { - int x = disabled; - disabled = 0; - return x; - } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index b3da601..b07f1fd 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -42,6 +42,9 @@ system: event-chains: true # Should Enterprise options be enabled? Only set this to true if you're an advanced user. enterprise: false +# Use /anticheat check for a list of valid checks +disabled-checks: +- EXAMPLE_CHECK disable-in: - example-world - example-world-2