It was the ultimate refactor... of ultimate destiny.

Now requires use of getters and setters for MVWorld things.
This commit is contained in:
Eric Stokes 2011-06-26 14:56:59 -06:00
parent d4729653a1
commit 532e2c2f75
10 changed files with 156 additions and 130 deletions

View File

@ -63,8 +63,8 @@ public class MVEntityListener extends EntityListener {
*/ */
if (event.getEntity() instanceof Animals) { if (event.getEntity() instanceof Animals) {
// If we have no exceptions for Animals then we just follow the Spawn setting. // If we have no exceptions for Animals then we just follow the Spawn setting.
if (mvworld.animalList.size() <= 0) { if (mvworld.getAnimalList().isEmpty()) {
if (mvworld.animals) { if (mvworld.hasAnimals()) {
return; return;
} else { } else {
event.setCancelled(true); event.setCancelled(true);
@ -72,8 +72,8 @@ public class MVEntityListener extends EntityListener {
} }
} }
// The idea of the Exceptions is they do the OPPOSITE of what the Spawn setting is... // The idea of the Exceptions is they do the OPPOSITE of what the Spawn setting is...
if (mvworld.animalList.contains(creature.toString())) { if (mvworld.getAnimalList().contains(creature.toString())) {
if (mvworld.animals) { if (mvworld.hasAnimals()) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} else { } else {
@ -86,8 +86,8 @@ public class MVEntityListener extends EntityListener {
*/ */
if (event.getEntity() instanceof Monster || event.getEntity() instanceof Ghast || event.getEntity() instanceof PigZombie || event.getEntity() instanceof Slime) { if (event.getEntity() instanceof Monster || event.getEntity() instanceof Ghast || event.getEntity() instanceof PigZombie || event.getEntity() instanceof Slime) {
// If we have no exceptions for Monsters then we just follow the Spawn setting. // If we have no exceptions for Monsters then we just follow the Spawn setting.
if (mvworld.monsterList.size() <= 0) { if (mvworld.getMonsterList().isEmpty()) {
if (mvworld.monsters) { if (mvworld.hasMonsters()) {
return; return;
} else { } else {
event.setCancelled(true); event.setCancelled(true);
@ -95,8 +95,8 @@ public class MVEntityListener extends EntityListener {
} }
} }
// The idea of the Exceptions is they do the OPPOSITE of what the Spawn setting is... // The idea of the Exceptions is they do the OPPOSITE of what the Spawn setting is...
if (mvworld.monsterList.contains(creature.toString())) { if (mvworld.getMonsterList().contains(creature.toString())) {
if (mvworld.monsters) { if (mvworld.hasMonsters()) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} else { } else {

View File

@ -47,7 +47,7 @@ public class MVPermissions {
* @return * @return
*/ */
public Boolean canTravelFromWorld(Player p, World w) { public Boolean canTravelFromWorld(Player p, World w) {
List<String> blackList = this.plugin.getMVWorld(w.getName()).worldBlacklist; List<String> blackList = this.plugin.getMVWorld(w.getName()).getWorldBlacklist();
boolean returnValue = true; boolean returnValue = true;
@ -74,9 +74,10 @@ public class MVPermissions {
*/ */
public Boolean canEnterWorld(Player p, World w) { public Boolean canEnterWorld(Player p, World w) {
List<String> whiteList = this.plugin.getMVWorld(w.getName()).playerWhitelist; List<String> whiteList = this.plugin.getMVWorld(w.getName()).getPlayerWhitelist();
List<String> blackList = this.plugin.getMVWorld(w.getName()).playerBlacklist; List<String> blackList = this.plugin.getMVWorld(w.getName()).getPlayerBlacklist();
System.out.print(blackList);
System.out.print(whiteList);
boolean returnValue = true; boolean returnValue = true;
// I lied. You definitely want this. Sorry Rigby :( You were right. --FF // I lied. You definitely want this. Sorry Rigby :( You were right. --FF

View File

@ -39,8 +39,8 @@ public class MVTeleport {
double x, y, z; double x, y, z;
// Grab the Scaling value for each world. // Grab the Scaling value for each world.
double srcComp = this.plugin.getMVWorld(l.getWorld().getName()).scaling; double srcComp = this.plugin.getMVWorld(l.getWorld().getName()).getScaling();
double trgComp = this.plugin.getMVWorld(w.getName()).scaling; double trgComp = this.plugin.getMVWorld(w.getName()).getScaling();
// MultiverseCore.debugMsg(p.getName() + " -> " + p.getWorld().getName() + "(" + srcComp + ") -> " + w.getName() + "(" + trgComp + ")"); // MultiverseCore.debugMsg(p.getName() + " -> " + p.getWorld().getName() + "(" + srcComp + ") -> " + w.getName() + "(" + trgComp + ")");

View File

@ -13,31 +13,33 @@ public class MVWorld {
private MultiverseCore plugin; // Hold the Plugin Instance. private MultiverseCore plugin; // Hold the Plugin Instance.
private Configuration config; // Hold the Configuration File. private Configuration config; // Hold the Configuration File.
public World world; // The World Instance. private World world; // The World Instance.
private Environment environment; // Hold the Environment type EG Environment.NETHER / Environment.NORMAL private Environment environment; // Hold the Environment type EG Environment.NETHER / Environment.NORMAL
private Long seed; private Long seed;
public String name; // The Worlds Name, EG its folder name. private String name; // The Worlds Name, EG its folder name.
public String alias = ""; // Short Alias for the World, this will be used in Chat Prefixes. private String alias = ""; // Short Alias for the World, this will be used in Chat Prefixes.
public Boolean animals; // Does this World allow Animals to Spawn? private boolean allowAnimals; // Does this World allow Animals to Spawn?
public List<String> animalList = new ArrayList<String>(); // Contain a list of Animals which we want to ignore the Spawn Setting. //public List<String> animals = new ArrayList<String>(); // Contain a list of Animals which we want to ignore the Spawn Setting.
public Boolean monsters; // Does this World allow Monsters to Spawn? private boolean allowMonsters; // Does this World allow Monsters to Spawn?
public List<String> monsterList = new ArrayList<String>(); // Contain a list of Monsters which we want to ignore the Spawn Setting. //public List<String> monsters = new ArrayList<String>(); // Contain a list of Monsters which we want to ignore the Spawn Setting.
private Boolean pvp; // Does this World allow PVP? private Boolean pvp; // Does this World allow PVP?
public List<Integer> blockBlacklist; // Contain a list of Blocks which we won't allow on this World. private List<Integer> blockBlacklist; // Contain a list of Blocks which we won't allow on this World.
public List<String> playerWhitelist; // Contain a list of Players/Groups which can join this World.
public List<String> playerBlacklist; // Contain a list of Players/Groups which cannot join this World.
public List<String> editWhitelist; // Contain a list of Players/Groups which can edit this World. (Place/Destroy Blocks)
public List<String> editBlacklist; // Contain a list of Players/Groups which cannot edit this World. (Place/Destroy Blocks)
public List<String> worldBlacklist; // Contain a list of Worlds which Players cannot use to Portal to this World.
public HashMap<String, List<String>> masterList; // These have been moved to a hash, for easy editing with strings.
// private List<String> playerWhitelist; // Contain a list of Players/Groups which can join this World.
// private List<String> playerBlacklist; // Contain a list of Players/Groups which cannot join this World.
// private List<String> editWhitelist; // Contain a list of Players/Groups which can edit this World. (Place/Destroy Blocks)
// private List<String> editBlacklist; // Contain a list of Players/Groups which cannot edit this World. (Place/Destroy Blocks)
// private List<String> worldBlacklist; // Contain a list of Worlds which Players cannot use to Portal to this World.
public Double scaling; // How stretched/compressed distances are private HashMap<String, List<String>> masterList;
private Double scaling; // How stretched/compressed distances are
/** /**
* The generator as a string. This is used only for reporting. ex: BukkitFullOfMoon:GenID * The generator as a string. This is used only for reporting. ex: BukkitFullOfMoon:GenID
*/ */
@ -54,6 +56,9 @@ public class MVWorld {
this.seed = seed; this.seed = seed;
this.environment = world.getEnvironment(); this.environment = world.getEnvironment();
// Initialize our lists
this.initLists();
// Write these files to the config (once it's saved) // Write these files to the config (once it's saved)
if (generatorString != null) { if (generatorString != null) {
config.setProperty("worlds." + this.name + ".generator", this.generator); config.setProperty("worlds." + this.name + ".generator", this.generator);
@ -63,9 +68,6 @@ public class MVWorld {
} }
config.setProperty("worlds." + this.name + ".environment", this.environment.toString()); config.setProperty("worlds." + this.name + ".environment", this.environment.toString());
// Initialize our lists
this.initLists();
// Set local values that CAN be changed by the user // Set local values that CAN be changed by the user
this.setAlias(config.getString("worlds." + this.name + ".alias", "")); this.setAlias(config.getString("worlds." + this.name + ".alias", ""));
this.setPvp(config.getBoolean("worlds." + this.name + ".pvp", true)); this.setPvp(config.getBoolean("worlds." + this.name + ".pvp", true));
@ -75,12 +77,12 @@ public class MVWorld {
this.setMonsters(config.getBoolean("worlds." + this.name + ".monsters.spawn", true)); this.setMonsters(config.getBoolean("worlds." + this.name + ".monsters.spawn", true));
this.getMobExceptions(); this.getMobExceptions();
this.playerWhitelist = config.getStringList("worlds." + this.name + ".playerwhitelist", this.playerWhitelist); this.getPlayerWhitelist().addAll(config.getStringList("worlds." + this.name + ".playerwhitelist", new ArrayList<String>()));
this.playerBlacklist = config.getStringList("worlds." + this.name + ".playerblacklist", this.playerBlacklist); this.getPlayerBlacklist().addAll(config.getStringList("worlds." + this.name + ".playerblacklist", new ArrayList<String>()));
this.worldBlacklist = config.getStringList("worlds." + this.name + ".worldblacklist", this.worldBlacklist); this.getWorldBlacklist().addAll(config.getStringList("worlds." + this.name + ".worldblacklist", new ArrayList<String>()));
this.blockBlacklist = config.getIntList("worlds." + this.name + ".blockblacklist", this.blockBlacklist); this.getBlockBlacklist().addAll(config.getIntList("worlds." + this.name + ".blockblacklist", new ArrayList<Integer>()));
this.editWhitelist = config.getStringList("worlds." + this.name + ".editwhitelist", this.editWhitelist); this.getEditWhitelist().addAll(config.getStringList("worlds." + this.name + ".editwhitelist", new ArrayList<String>()));
this.editBlacklist = config.getStringList("worlds." + this.name + ".editblacklist", this.editBlacklist); this.getEditBlacklist().addAll(config.getStringList("worlds." + this.name + ".editblacklist", new ArrayList<String>()));
config.save(); config.save();
// The following 3 lines will add some sample data to new worlds created. // The following 3 lines will add some sample data to new worlds created.
@ -91,16 +93,16 @@ public class MVWorld {
private void getMobExceptions() { private void getMobExceptions() {
List<String> temp; List<String> temp;
temp = this.config.getStringList("worlds." + this.name + ".animals.exceptions", this.animalList); temp = this.config.getStringList("worlds." + this.name + ".animals.exceptions", new ArrayList<String>());
// Add Animals to the exclusion list // Add Animals to the exclusion list
this.animalList.clear();
for (String s : temp) { for (String s : temp) {
this.animalList.add(s.toUpperCase()); this.masterList.get("animals").add(s.toUpperCase());
} }
temp = this.config.getStringList("worlds." + this.name + ".monsters.exceptions", this.monsterList); temp = this.config.getStringList("worlds." + this.name + ".monsters.exceptions", new ArrayList<String>());
// Add Monsters to the exclusion list // Add Monsters to the exclusion list
for (String s : temp) { for (String s : temp) {
this.monsterList.add(s.toUpperCase()); this.masterList.get("monsters").add(s.toUpperCase());
} }
} }
@ -112,56 +114,52 @@ public class MVWorld {
this.masterList = new HashMap<String, List<String>>(); this.masterList = new HashMap<String, List<String>>();
this.blockBlacklist = new ArrayList<Integer>(); this.blockBlacklist = new ArrayList<Integer>();
// Only int list, we don't need to add it to the masterlist // Only int list, we don't need to add it to the masterlist
this.playerWhitelist = new ArrayList<String>(); this.masterList.put("playerwhitelist", new ArrayList<String>());
this.masterList.put("playerwhitelist", this.playerWhitelist); this.masterList.put("playerblacklist", new ArrayList<String>());
this.playerBlacklist = new ArrayList<String>(); this.masterList.put("editwhitelist", new ArrayList<String>());
this.masterList.put("playerblacklist", this.playerBlacklist); this.masterList.put("editblacklist", new ArrayList<String>());
this.editWhitelist = new ArrayList<String>(); this.masterList.put("worldblacklist", new ArrayList<String>());
this.masterList.put("editwhitelist", this.editWhitelist); this.masterList.put("animals", new ArrayList<String>());
this.editBlacklist = new ArrayList<String>(); this.masterList.put("monsters", new ArrayList<String>());
this.masterList.put("editblacklist", this.editBlacklist);
this.worldBlacklist = new ArrayList<String>();
this.masterList.put("worldblacklist", this.worldBlacklist);
} }
public void addSampleData() { public void addSampleData() {
this.monsterList.add("creeper"); this.getMonsterList().add("creeper");
this.animalList.add("pig"); this.getAnimalList().add("pig");
this.blockBlacklist.add(49); this.blockBlacklist.add(49);
this.playerWhitelist.add("fernferret"); this.getPlayerWhitelist().add("fernferret");
this.playerWhitelist.add("g:Admins"); this.getPlayerBlacklist().add("g:Admins");
this.playerBlacklist.add("Rigby90"); this.getPlayerBlacklist().add("Rigby90");
this.playerBlacklist.add("g:Banned"); this.getPlayerBlacklist().add("g:Banned");
this.editWhitelist.add("fernferret"); this.getEditWhitelist().add("fernferret");
this.editWhitelist.add("g:Admins"); this.getEditWhitelist().add("g:Admins");
this.editBlacklist.add("Rigby90"); this.getEditBlacklist().add("Rigby90");
this.editBlacklist.add("g:Banned"); this.getEditBlacklist().add("g:Banned");
this.worldBlacklist.add("world5"); this.getWorldBlacklist().add("world5");
this.worldBlacklist.add("A world with spaces"); this.getWorldBlacklist().add("A world with spaces");
this.config.setProperty("worlds." + this.name + ".animals.exceptions", this.animalList); this.config.setProperty("worlds." + this.name + ".animals.exceptions", this.getAnimalList());
this.config.setProperty("worlds." + this.name + ".monsters.exceptions", this.monsterList); this.config.setProperty("worlds." + this.name + ".monsters.exceptions", this.getMonsterList());
this.config.setProperty("worlds." + this.name + ".blockBlacklist", this.blockBlacklist); this.config.setProperty("worlds." + this.name + ".blockblacklist", this.getBlockBlacklist());
this.config.setProperty("worlds." + this.name + ".playerWhitelist", this.playerWhitelist); this.config.setProperty("worlds." + this.name + ".playerwhitelist", this.getPlayerWhitelist());
this.config.setProperty("worlds." + this.name + ".playerBlacklist", this.playerBlacklist); this.config.setProperty("worlds." + this.name + ".playerblacklist", this.getPlayerBlacklist());
this.config.setProperty("worlds." + this.name + ".editWhitelist", this.editWhitelist); this.config.setProperty("worlds." + this.name + ".editwhitelist", this.getEditWhitelist());
this.config.setProperty("worlds." + this.name + ".editBlacklist", this.editBlacklist); this.config.setProperty("worlds." + this.name + ".editblacklist", this.getEditBlacklist());
this.config.setProperty("worlds." + this.name + ".worldBlacklist", this.worldBlacklist); this.config.setProperty("worlds." + this.name + ".worldblacklist", this.getWorldBlacklist());
this.config.save(); this.config.save();
} }
public boolean clearVariable(String property) { public boolean clearVariable(String property) {
if(property.equalsIgnoreCase("blockblacklist")) { if (property.equalsIgnoreCase("blockblacklist")) {
this.blockBlacklist.clear(); this.blockBlacklist.clear();
} } else if (this.masterList.keySet().contains(property)) {
else if (this.masterList.keySet().contains(property)) {
this.masterList.get(property).clear(); this.masterList.get(property).clear();
} else { } else {
return false; return false;
@ -172,41 +170,74 @@ public class MVWorld {
} }
public boolean addToList(String list, String value) { public boolean addToList(String list, String value) {
if(list.equalsIgnoreCase("blockblacklist")) { System.out.print("Trying to add " + value + " to " + list);
try{ if (list.equalsIgnoreCase("blockblacklist")) {
try {
int intVal = Integer.parseInt(value); int intVal = Integer.parseInt(value);
return addToList(list, intVal); return addToList(list, intVal);
} catch (Exception e) { } catch (Exception e) {
} }
} } else if (this.masterList.keySet().contains(list)) {
if (this.masterList.keySet().contains(list)) {
this.masterList.get(list).add(value); this.masterList.get(list).add(value);
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase(), this.blockBlacklist); System.out.print(this.masterList.get(list));
if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
this.syncMobs();
} else {
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase(), this.masterList.get(list));
}
this.config.save(); this.config.save();
System.out.print(this.masterList.get(list));
return true; return true;
} }
return false; return false;
} }
public boolean removeFromList(String list, String value) { public boolean removeFromList(String list, String value) {
if(list.equalsIgnoreCase("blockblacklist")) { if (list.equalsIgnoreCase("blockblacklist")) {
try{ try {
int intVal = Integer.parseInt(value); int intVal = Integer.parseInt(value);
return removeFromList(list, intVal); return removeFromList(list, intVal);
} catch (Exception e) { } catch (Exception e) {
} }
} }
if (this.masterList.keySet().contains(list)) { if (this.masterList.keySet().contains(list)) {
this.masterList.get(list).remove(value); this.masterList.get(list).remove(value);
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase(), this.blockBlacklist); if (list.equalsIgnoreCase("animals") || list.equalsIgnoreCase("monsters")) {
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase() + ".exceptions", this.masterList.get(list));
this.syncMobs();
} else {
this.config.setProperty("worlds." + this.name + "." + list.toLowerCase(), this.masterList.get(list));
}
this.config.save(); this.config.save();
return true; return true;
} }
return false; return false;
} }
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()) {
System.out.print(this.allowMonsters);
System.out.print(this.world);
System.out.print(this.world.getAllowAnimals());
this.world.setSpawnFlags(this.allowMonsters, this.world.getAllowAnimals());
if (!this.allowMonsters) {
// TODO: Purge
}
} else {
this.world.setSpawnFlags(true, this.world.getAllowAnimals());
}
}
private boolean addToList(String list, Integer value) { private boolean addToList(String list, Integer value) {
if (list.equalsIgnoreCase("blockblacklist")) { if (list.equalsIgnoreCase("blockblacklist")) {
this.blockBlacklist.add(value); this.blockBlacklist.add(value);
@ -246,8 +277,10 @@ public class MVWorld {
return false; return false;
} }
/** /**
* This is the one people have access to. It'll handle the rest. * This is the one people have access to. It'll handle the rest.
*
* @param name * @param name
* @param value * @param value
* @return * @return
@ -304,52 +337,41 @@ public class MVWorld {
} }
public Boolean hasAnimals() { public Boolean hasAnimals() {
return this.animals; return this.allowAnimals;
} }
private void setAnimals(Boolean animals) { private void setAnimals(Boolean animals) {
System.out.print("Animals setting recieved: " + animals); System.out.print("Animals setting recieved: " + animals);
this.animals = animals; this.allowAnimals = animals;
// If animals are a boolean, then we can turn them on or off on the server // 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 // If there are ANY exceptions, there will be something spawning, so turn them on
if (this.getAnimalList().isEmpty()) {
this.world.setSpawnFlags(this.world.getAllowMonsters(), animals);
if(!animals) {
// TODO: Purge
}
} else {
this.world.setSpawnFlags(this.world.getAllowMonsters(), true);
}
System.out.print("Animals setting saved: " + animals); System.out.print("Animals setting saved: " + animals);
this.config.setProperty("worlds." + this.name + ".animals.spawn", animals); this.config.setProperty("worlds." + this.name + ".animals.spawn", animals);
this.config.save(); this.config.save();
this.syncMobs();
} }
public List<String> getAnimalList() { public List<String> getAnimalList() {
return this.animalList; return this.masterList.get("animals");
} }
public Boolean hasMonsters() { public Boolean hasMonsters() {
return this.monsters; return this.allowMonsters;
} }
private void setMonsters(Boolean monsters) { private void setMonsters(Boolean monsters) {
this.monsters = monsters; this.allowMonsters = monsters;
// If monsters are a boolean, then we can turn them on or off on the server // 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 // If there are ANY exceptions, there will be something spawning, so turn them on
if (this.getAnimalList().isEmpty()) {
this.world.setSpawnFlags(monsters, this.world.getAllowAnimals());
if(!monsters) {
// TODO: Purge
}
} else {
this.world.setSpawnFlags(true, this.world.getAllowAnimals());
}
this.config.setProperty("worlds." + this.name + ".monsters.spawn", monsters); this.config.setProperty("worlds." + this.name + ".monsters.spawn", monsters);
this.config.save(); this.config.save();
this.syncMobs();
} }
public List<String> getMonsterList() { public List<String> getMonsterList() {
return this.monsterList; return this.masterList.get("monsters");
} }
public Boolean getPvp() { public Boolean getPvp() {
@ -369,19 +391,23 @@ public class MVWorld {
} }
public List<String> getPlayerWhitelist() { public List<String> getPlayerWhitelist() {
return this.playerWhitelist; return this.masterList.get("playerwhitelist");
} }
public List<String> getPlayerBlacklist() { public List<String> getPlayerBlacklist() {
return this.playerBlacklist; return this.masterList.get("playerblacklist");
} }
public List<String> getEditWhitelist() { public List<String> getEditWhitelist() {
return this.editWhitelist; return this.masterList.get("editwhitelist");
} }
public List<String> getEditBlacklist() { public List<String> getEditBlacklist() {
return this.editBlacklist; return this.masterList.get("editblacklist");
}
public List<String> getWorldBlacklist() {
return this.masterList.get("worldblacklist");
} }
public Double getScaling() { public Double getScaling() {

View File

@ -236,24 +236,24 @@ public class MultiverseCore extends JavaPlugin {
if (world == null) if (world == null)
continue; continue;
MVWorld mvworld = this.worlds.get(key); MVWorld mvworld = this.worlds.get(key);
List<String> monsters = mvworld.monsterList; List<String> monsters = mvworld.getMonsterList();
List<String> animals = mvworld.animalList; List<String> animals = mvworld.getAnimalList();
System.out.print("Monster Size:" + monsters.size() + " - " + "Animal Size: " + animals.size()); System.out.print("Monster Size:" + monsters.size() + " - " + "Animal Size: " + animals.size());
for (Entity e : world.getEntities()) { for (Entity e : world.getEntities()) {
// Check against Monsters // Check against Monsters
if (e instanceof Creeper || e instanceof Skeleton || e instanceof Spider || e instanceof Zombie || e instanceof Ghast || e instanceof PigZombie || e instanceof Giant || e instanceof Slime || e instanceof Monster) { if (e instanceof Creeper || e instanceof Skeleton || e instanceof Spider || e instanceof Zombie || e instanceof Ghast || e instanceof PigZombie || e instanceof Giant || e instanceof Slime || e instanceof Monster) {
// If Monsters are disabled and there's no exceptions we can simply remove them. // If Monsters are disabled and there's no exceptions we can simply remove them.
if (mvworld.monsters == false && !(monsters.size() > 0)) { if (mvworld.hasMonsters() == false && !(monsters.size() > 0)) {
e.remove(); e.remove();
continue; continue;
} }
// If monsters are enabled and there's no exceptions we can continue to the next set. // If monsters are enabled and there's no exceptions we can continue to the next set.
if (mvworld.monsters == true && !(monsters.size() > 0)) { if (mvworld.hasMonsters() == true && !(monsters.size() > 0)) {
continue; continue;
} }
String creature = e.toString().replaceAll("Craft", ""); String creature = e.toString().replaceAll("Craft", "");
if (monsters.contains(creature.toUpperCase())) { if (monsters.contains(creature.toUpperCase())) {
if (mvworld.monsters) { if (mvworld.hasMonsters()) {
System.out.print(creature + " - Removed"); System.out.print(creature + " - Removed");
e.remove(); e.remove();
continue; continue;
@ -263,17 +263,17 @@ public class MultiverseCore extends JavaPlugin {
// Check against Animals // Check against Animals
if (e instanceof Chicken || e instanceof Cow || e instanceof Sheep || e instanceof Pig || e instanceof Squid || e instanceof Animals) { if (e instanceof Chicken || e instanceof Cow || e instanceof Sheep || e instanceof Pig || e instanceof Squid || e instanceof Animals) {
// If Monsters are disabled and there's no exceptions we can simply remove them. // If Monsters are disabled and there's no exceptions we can simply remove them.
if (mvworld.animals == false && !(animals.size() > 0)) { if (mvworld.hasAnimals() == false && !(animals.size() > 0)) {
e.remove(); e.remove();
continue; continue;
} }
// If monsters are enabled and there's no exceptions we can continue to the next set. // If monsters are enabled and there's no exceptions we can continue to the next set.
if (mvworld.animals == true && !(animals.size() > 0)) { if (mvworld.hasAnimals() == true && !(animals.size() > 0)) {
continue; continue;
} }
String creature = e.toString().replaceAll("Craft", ""); String creature = e.toString().replaceAll("Craft", "");
if (animals.contains(creature.toUpperCase())) { if (animals.contains(creature.toUpperCase())) {
if (mvworld.animals) { if (mvworld.hasAnimals()) {
e.remove(); e.remove();
continue; continue;
} }

View File

@ -29,7 +29,7 @@ public class CoordCommand extends BaseCommand {
if (sender instanceof Player) { if (sender instanceof Player) {
Player p = (Player) sender; Player p = (Player) sender;
p.sendMessage(ChatColor.RED + "World: " + ChatColor.WHITE + p.getWorld().getName()); p.sendMessage(ChatColor.RED + "World: " + ChatColor.WHITE + p.getWorld().getName());
p.sendMessage(ChatColor.RED + "World Scale: " + ChatColor.WHITE + this.plugin.getMVWorld(p.getWorld().getName()).scaling); p.sendMessage(ChatColor.RED + "World Scale: " + ChatColor.WHITE + this.plugin.getMVWorld(p.getWorld().getName()).getScaling());
p.sendMessage(ChatColor.RED + "Coordinates: " + ChatColor.WHITE + this.locMan.strCoords(p.getLocation())); p.sendMessage(ChatColor.RED + "Coordinates: " + ChatColor.WHITE + this.locMan.strCoords(p.getLocation()));
p.sendMessage(ChatColor.RED + "Direction: " + ChatColor.WHITE + this.locMan.getDirection(p.getLocation())); p.sendMessage(ChatColor.RED + "Direction: " + ChatColor.WHITE + this.locMan.getDirection(p.getLocation()));
p.sendMessage(ChatColor.RED + "Block: " + ChatColor.WHITE + Material.getMaterial(p.getWorld().getBlockTypeIdAt(p.getLocation()))); p.sendMessage(ChatColor.RED + "Block: " + ChatColor.WHITE + Material.getMaterial(p.getWorld().getBlockTypeIdAt(p.getLocation())));

View File

@ -48,10 +48,10 @@ public class InfoCommand extends BaseCommand {
ArrayList<String[]> pagedInfo = new ArrayList<String[]>(); ArrayList<String[]> pagedInfo = new ArrayList<String[]>();
String[] aPage = new String[3]; String[] aPage = new String[3];
// World Name: 1 // World Name: 1
aPage[0] = "World: " + world.name; aPage[0] = "World: " + world.getName();
// World Scale: 1 // World Scale: 1
aPage[1] = "World Scale: " + world.scaling; aPage[1] = "World Scale: " + world.getScaling();
// PVP: 1 // PVP: 1
aPage[2] = "PVP: " + world.getPvp(); aPage[2] = "PVP: " + world.getPvp();

View File

@ -47,7 +47,7 @@ public class ListCommand extends BaseCommand {
color = ChatColor.AQUA; color = ChatColor.AQUA;
} }
output += ChatColor.WHITE + world.name + " - " + color + world.getEnvironment() + " \n"; output += ChatColor.WHITE + world.getName() + " - " + color + world.getEnvironment() + " \n";
} }
String[] response = output.split("\n"); String[] response = output.split("\n");

View File

@ -18,7 +18,7 @@ enum Action {
// This will contain all the properties that support the ADD/REMOVE // This will contain all the properties that support the ADD/REMOVE
// Anything not in here will only support the SET action // Anything not in here will only support the SET action
enum AddProperties { enum AddProperties {
animallist, monsterlist, blockblacklist, playerwhitelist, playerblacklist, editwhitelist, editblacklist, worldblacklist animallist, monsterlist, blockblacklist, playerwhitelist, playerblacklist, editwhitelist, editblacklist, worldblacklist, animals, monsters
} }
enum SetProperties { enum SetProperties {
@ -92,9 +92,8 @@ public class ModifyCommand extends BaseCommand {
} else { } else {
sender.sendMessage("There was an error setting " + property); sender.sendMessage("There was an error setting " + property);
} }
return;
} else if (action == Action.Add) { } else if (action == Action.Add) {
if (world.removeFromList(property, value)) { if (world.addToList(property, value)) {
sender.sendMessage(value + " was added to " + property); sender.sendMessage(value + " was added to " + property);
} else { } else {
sender.sendMessage(value + " could not be added to " + property); sender.sendMessage(value + " could not be added to " + property);

View File

@ -49,11 +49,11 @@ public class WhoCommand extends BaseCommand {
} }
for (MVWorld world : worlds) { for (MVWorld world : worlds) {
if (!(this.plugin.isMVWorld(world.name))) { if (!(this.plugin.isMVWorld(world.getName()))) {
continue; continue;
} }
World w = this.plugin.getServer().getWorld(world.name); World w = this.plugin.getServer().getWorld(world.getName());
if (p != null && (!this.plugin.ph.canEnterWorld(p, w))) { if (p != null && (!this.plugin.ph.canEnterWorld(p, w))) {
continue; continue;
} }
@ -77,7 +77,7 @@ public class WhoCommand extends BaseCommand {
result += player.getName() + " "; result += player.getName() + " ";
} }
} }
sender.sendMessage(color + world.name + ChatColor.WHITE + " - " + result); sender.sendMessage(color + world.getName() + ChatColor.WHITE + " - " + result);
} }
return; return;
} }