diff --git a/src/main/java/net/h31ix/anticheat/manage/CheckManager.java b/src/main/java/net/h31ix/anticheat/manage/CheckManager.java index 7e93ac9..cf785e2 100644 --- a/src/main/java/net/h31ix/anticheat/manage/CheckManager.java +++ b/src/main/java/net/h31ix/anticheat/manage/CheckManager.java @@ -56,7 +56,7 @@ public class CheckManager public void deactivateCheck(CheckType type) { if (!isActive(type)) - { + { manager.log("The " + type.toString() + " check was deactivated."); checkIgnoreList.add(type); disabled++; @@ -95,7 +95,7 @@ public class CheckManager { return exemptList.containsKey(player.getName()) ? exemptList.get(player.getName()).contains(type) : false; } - + public boolean isOpExempt(Player player) { return (this.manager.getConfiguration().opExempt() && player.isOp()); @@ -105,7 +105,7 @@ public class CheckManager { return isActive(type) && manager.getConfiguration().checkInWorld(player.getWorld()) && !isExempt(player, type) && !type.checkPermission(player) && isOnline(player) && !isOpExempt(player); } - + public boolean isOnline(Player player) { // Check if the player is on the user list, e.g. is not an NPC diff --git a/src/main/java/net/h31ix/anticheat/util/Configuration.java b/src/main/java/net/h31ix/anticheat/util/Configuration.java index 1da612c..077e35b 100644 --- a/src/main/java/net/h31ix/anticheat/util/Configuration.java +++ b/src/main/java/net/h31ix/anticheat/util/Configuration.java @@ -55,7 +55,7 @@ public class Configuration private int highThreshold = 0; private String updateFolder; private static Language language; - private List worlds = new ArrayList(); + private List exemptWorlds = new ArrayList(); public Configuration(AnticheatManager instance) { @@ -179,17 +179,34 @@ public class Configuration opExempt = getBoolean("System.Exempt op", false); trackCreativeXRay = getBoolean("XRay.Track creative", true); - if (config.getList("Enable in") == null) + // Worlds + List list = new ArrayList(); + list.add("example-world"); + list.add("example-world-2"); + + if (config.getList("Enable in") != null) { - List w = new ArrayList(); - for (World world : Bukkit.getServer().getWorlds()) + List list2 = config.getStringList("Enable in"); + List list3 = new ArrayList(); + for(World world : micromanage.getPlugin().getServer().getWorlds()) { - w.add(world.getName()); + if(!list2.contains(world.getName())) + { + list3.add(world.getName()); + } } - config.set("Enable in", w); - save(); + if(!list3.isEmpty()) + { + list = list3; + } + config.set("Enable in", null); } - worlds = config.getStringList("Enable in"); + if (config.getList("Disable in") == null) + { + config.set("Disable in", list); + } + + exemptWorlds = config.getStringList("Disable in"); // End pulling values from config save(); } @@ -239,9 +256,9 @@ public class Configuration } } - public List getWorlds() + public List getWorldsExempt() { - return worlds; + return exemptWorlds; } public File getConfigFile() @@ -261,7 +278,7 @@ public class Configuration public boolean checkInWorld(World world) { - return worlds.contains(world.getName()); + return !exemptWorlds.contains(world.getName()); } public int getLevel(String player)