Migrate enable-in list to disable-in list

This commit is contained in:
h31ix committed 2012-10-13 13:09:05 -04:00
1 parent 9714cfd767
commit 493a9c8d33
2 files changed
+31 -14

No files matched your search

@@ -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
@@ -55,7 +55,7 @@ public class Configuration
private int highThreshold = 0;
private String updateFolder;
private static Language language;
private List<String> worlds = new ArrayList<String>();
private List<String> exemptWorlds = new ArrayList<String>();
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<String> list = new ArrayList<String>();
list.add("example-world");
list.add("example-world-2");
if (config.getList("Enable in") != null)
{
List<String> w = new ArrayList<String>();
for (World world : Bukkit.getServer().getWorlds())
List<String> list2 = config.getStringList("Enable in");
List<String> list3 = new ArrayList<String>();
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<String> getWorlds()
public List<String> 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)