diff --git a/src/com/onarandombox/MultiverseCore/MVWorld.java b/src/com/onarandombox/MultiverseCore/MVWorld.java index 7152a2ff..ae622ce8 100644 --- a/src/com/onarandombox/MultiverseCore/MVWorld.java +++ b/src/com/onarandombox/MultiverseCore/MVWorld.java @@ -227,27 +227,26 @@ public class MVWorld { private void syncMobs() { if (this.getAnimalList().isEmpty()) { this.world.setSpawnFlags(this.world.getAllowMonsters(), this.allowAnimals); - if (!this.allowAnimals) { - // TODO: Purge - } } else { this.world.setSpawnFlags(this.world.getAllowMonsters(), true); } - if (this.getMonsterList().isEmpty()) { this.world.setSpawnFlags(this.allowMonsters, this.world.getAllowAnimals()); - if (!this.allowMonsters) { - // TODO: Purge - } } else { this.world.setSpawnFlags(true, this.world.getAllowAnimals()); } + System.out.print("Animals: " + this.world.getAllowAnimals()); + System.out.print("Monsters: " + this.world.getAllowMonsters()); + System.out.print("Animal List: " + this.getAnimalList()); + System.out.print("Monster List: " + this.getMonsterList()); + this.plugin.getWorldPurger().purgeWorld(null, this); } private boolean addToList(String list, Integer value) { if (list.equalsIgnoreCase("blockblacklist")) { this.blockBlacklist.add(value); this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist); + this.config.save(); } return false; @@ -257,6 +256,7 @@ public class MVWorld { if (list.equalsIgnoreCase("blockblacklist")) { this.blockBlacklist.remove(value); this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist); + this.config.save(); } return false; @@ -266,8 +266,10 @@ public class MVWorld { if (name.equalsIgnoreCase("pvp")) { this.setPvp(value); } else if (name.equalsIgnoreCase("animals")) { + this.setAnimals(value); } else if (name.equalsIgnoreCase("monsters")) { + System.out.print("Trying to set monsters to: " + value); this.setMonsters(value); } else { return false; @@ -350,7 +352,6 @@ public class MVWorld { this.allowAnimals = animals; // If animals are a boolean, then we can turn them on or off on the server // If there are ANY exceptions, there will be something spawning, so turn them on - this.config.setProperty("worlds." + this.name + ".animals.spawn", animals); this.config.save(); this.syncMobs(); @@ -368,7 +369,6 @@ public class MVWorld { this.allowMonsters = monsters; // If monsters are a boolean, then we can turn them on or off on the server // If there are ANY exceptions, there will be something spawning, so turn them on - this.config.setProperty("worlds." + this.name + ".monsters.spawn", monsters); this.config.save(); this.syncMobs(); @@ -481,4 +481,19 @@ public class MVWorld { return ChatColor.WHITE; return null; } + + public boolean clearList(String property) { + if(property.equalsIgnoreCase("blockblacklist")) { + this.blockBlacklist.clear(); + this.config.setProperty("worlds." + this.name + ".blockblacklist", this.blockBlacklist); + this.config.save(); + return true; + } else if(this.masterList.containsKey(property)) { + this.masterList.get(property).clear(); + this.config.setProperty("worlds." + this.masterList.get(property) + "." + property.toLowerCase(), this.blockBlacklist); + this.config.save(); + return true; + } + return false; + } } diff --git a/src/com/onarandombox/MultiverseCore/command/commands/InfoCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/InfoCommand.java index f19d2193..542dacd1 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/InfoCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/InfoCommand.java @@ -46,7 +46,7 @@ public class InfoCommand extends BaseCommand { private String[] buildEntireCommand(MVWorld world) { StringBuilder sb = new StringBuilder(); ArrayList pagedInfo = new ArrayList(); - String[] aPage = new String[3]; + String[] aPage = new String[5]; // World Name: 1 aPage[0] = "World: " + world.getName(); @@ -55,6 +55,8 @@ public class InfoCommand extends BaseCommand { // PVP: 1 aPage[2] = "PVP: " + world.getPvp(); + aPage[3] = "Animals: " + world.allowAnimalSpawning(); + aPage[4] = "Monsters: " + world.allowMonsterSpawning(); // This feature is not mission critical and I am spending too much time on it... // Stopping work on it for now --FF 20110623 diff --git a/src/com/onarandombox/MultiverseCore/command/commands/ModifyCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/ModifyCommand.java index c18597ec..9a0c1049 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/ModifyCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/ModifyCommand.java @@ -24,13 +24,12 @@ enum SetProperties { public class ModifyCommand extends BaseCommand { - public ModifyCommand(MultiverseCore plugin) { super(plugin); this.name = "Modify a World"; this.description = "Modify various aspects of worlds. See the help wiki for how to use this command properly. If you do not include a world, the current world will be used"; - this.usage = "/mvmodify" + ChatColor.GOLD + " [WORLD] " + ChatColor.GREEN + "{SET|ADD|REMOVE|CLEAR} {PROPERTY} {VALUE}"; - this.minArgs = 3; + this.usage = "/mvmodify" + ChatColor.GOLD + " [WORLD] " + ChatColor.GREEN + "{SET|ADD|REMOVE|CLEAR} {PROPERTY} {VALUE|all}"; + this.minArgs = 2; this.maxArgs = 4; this.identifiers.add("mvmodify"); this.permission = "multiverse.world.modify"; @@ -51,6 +50,7 @@ public class ModifyCommand extends BaseCommand { String value; String property; Player p; + // Handle special CLEAR case if (args.length == 3) { p = (Player) sender; world = this.plugin.getMVWorld(p.getWorld().getName()); @@ -98,8 +98,12 @@ public class ModifyCommand extends BaseCommand { } else { sender.sendMessage(value + " could not be removed from " + property); } - } else if(action == Action.Clear) { - + } else if (action == Action.Clear) { + if (world.clearList(property)) { + sender.sendMessage(property + " was cleared. It contains 0 values now."); + } else { + sender.sendMessage(property + " was NOT cleared."); + } } } @@ -132,6 +136,9 @@ public class ModifyCommand extends BaseCommand { if (action.equalsIgnoreCase("remove") || action.equalsIgnoreCase("-")) { return Action.Remove; } + if (action.equalsIgnoreCase("clear")) { + return Action.Clear; + } return null; } diff --git a/src/com/onarandombox/MultiverseCore/command/commands/PurgeCommand.java b/src/com/onarandombox/MultiverseCore/command/commands/PurgeCommand.java index 0e63a42b..388814e2 100644 --- a/src/com/onarandombox/MultiverseCore/command/commands/PurgeCommand.java +++ b/src/com/onarandombox/MultiverseCore/command/commands/PurgeCommand.java @@ -7,8 +7,6 @@ import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import sun.tools.tree.ArrayAccessExpression; - import com.onarandombox.MultiverseCore.MVWorld; import com.onarandombox.MultiverseCore.MultiverseCore; import com.onarandombox.MultiverseCore.command.BaseCommand; @@ -60,6 +58,8 @@ public class PurgeCommand extends BaseCommand { PurgeWorlds purger = this.plugin.getWorldPurger(); ArrayList thingsToKill = new ArrayList(); if(deathName.equalsIgnoreCase("all") || deathName.equalsIgnoreCase("animals") || deathName.equalsIgnoreCase("monsters")) { + System.out.print("Found a special case: "); + System.out.print(deathName.toUpperCase()); thingsToKill.add(deathName.toUpperCase()); } else { Collections.addAll(thingsToKill, deathName.split(",")); diff --git a/src/com/onarandombox/utils/PurgeWorlds.java b/src/com/onarandombox/utils/PurgeWorlds.java index 8ec2d7da..bcdfcc7b 100644 --- a/src/com/onarandombox/utils/PurgeWorlds.java +++ b/src/com/onarandombox/utils/PurgeWorlds.java @@ -73,7 +73,7 @@ public class PurgeWorlds { private boolean killCreature(MVWorld mvworld, Entity e, List creaturesToKill, boolean negate) { String entityName = e.toString().replaceAll("Craft", "").toUpperCase(); if (e instanceof Squid || e instanceof Animals) { - if (creaturesToKill.contains(entityName) || creaturesToKill.contains("ALL") || creaturesToKill.contains("CREATURES")) { + if (creaturesToKill.contains(entityName) || creaturesToKill.contains("ALL") || creaturesToKill.contains("ANIMALS")) { if (!negate) { System.out.print(entityName + " - Removed"); e.remove();