mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-09-06 12:38:07 +02:00
It was the ultimate refactor... of ultimate destiny.
Now requires use of getters and setters for MVWorld things.
This commit is contained in:
parent
d4729653a1
commit
532e2c2f75
@ -63,8 +63,8 @@ public class MVEntityListener extends EntityListener {
|
||||
*/
|
||||
if (event.getEntity() instanceof Animals) {
|
||||
// If we have no exceptions for Animals then we just follow the Spawn setting.
|
||||
if (mvworld.animalList.size() <= 0) {
|
||||
if (mvworld.animals) {
|
||||
if (mvworld.getAnimalList().isEmpty()) {
|
||||
if (mvworld.hasAnimals()) {
|
||||
return;
|
||||
} else {
|
||||
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...
|
||||
if (mvworld.animalList.contains(creature.toString())) {
|
||||
if (mvworld.animals) {
|
||||
if (mvworld.getAnimalList().contains(creature.toString())) {
|
||||
if (mvworld.hasAnimals()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} 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 we have no exceptions for Monsters then we just follow the Spawn setting.
|
||||
if (mvworld.monsterList.size() <= 0) {
|
||||
if (mvworld.monsters) {
|
||||
if (mvworld.getMonsterList().isEmpty()) {
|
||||
if (mvworld.hasMonsters()) {
|
||||
return;
|
||||
} else {
|
||||
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...
|
||||
if (mvworld.monsterList.contains(creature.toString())) {
|
||||
if (mvworld.monsters) {
|
||||
if (mvworld.getMonsterList().contains(creature.toString())) {
|
||||
if (mvworld.hasMonsters()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} else {
|
||||
|
@ -47,7 +47,7 @@ public class MVPermissions {
|
||||
* @return
|
||||
*/
|
||||
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;
|
||||
|
||||
@ -74,9 +74,10 @@ public class MVPermissions {
|
||||
*/
|
||||
public Boolean canEnterWorld(Player p, World w) {
|
||||
|
||||
List<String> whiteList = this.plugin.getMVWorld(w.getName()).playerWhitelist;
|
||||
List<String> blackList = this.plugin.getMVWorld(w.getName()).playerBlacklist;
|
||||
|
||||
List<String> whiteList = this.plugin.getMVWorld(w.getName()).getPlayerWhitelist();
|
||||
List<String> blackList = this.plugin.getMVWorld(w.getName()).getPlayerBlacklist();
|
||||
System.out.print(blackList);
|
||||
System.out.print(whiteList);
|
||||
boolean returnValue = true;
|
||||
|
||||
// I lied. You definitely want this. Sorry Rigby :( You were right. --FF
|
||||
|
@ -39,8 +39,8 @@ public class MVTeleport {
|
||||
double x, y, z;
|
||||
|
||||
// Grab the Scaling value for each world.
|
||||
double srcComp = this.plugin.getMVWorld(l.getWorld().getName()).scaling;
|
||||
double trgComp = this.plugin.getMVWorld(w.getName()).scaling;
|
||||
double srcComp = this.plugin.getMVWorld(l.getWorld().getName()).getScaling();
|
||||
double trgComp = this.plugin.getMVWorld(w.getName()).getScaling();
|
||||
|
||||
// MultiverseCore.debugMsg(p.getName() + " -> " + p.getWorld().getName() + "(" + srcComp + ") -> " + w.getName() + "(" + trgComp + ")");
|
||||
|
||||
|
@ -13,31 +13,33 @@ public class MVWorld {
|
||||
private MultiverseCore plugin; // Hold the Plugin Instance.
|
||||
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 Long seed;
|
||||
|
||||
public 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 name; // The Worlds Name, EG its folder name.
|
||||
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?
|
||||
public List<String> animalList = new ArrayList<String>(); // Contain a list of Animals which we want to ignore the Spawn Setting.
|
||||
private boolean allowAnimals; // Does this World allow Animals to Spawn?
|
||||
//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?
|
||||
public List<String> monsterList = new ArrayList<String>(); // Contain a list of Monsters which we want to ignore the Spawn Setting.
|
||||
private boolean allowMonsters; // Does this World allow Monsters to Spawn?
|
||||
//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?
|
||||
|
||||
public 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.
|
||||
private List<Integer> blockBlacklist; // Contain a list of Blocks which we won't allow on 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
|
||||
*/
|
||||
@ -54,6 +56,9 @@ public class MVWorld {
|
||||
this.seed = seed;
|
||||
this.environment = world.getEnvironment();
|
||||
|
||||
// Initialize our lists
|
||||
this.initLists();
|
||||
|
||||
// Write these files to the config (once it's saved)
|
||||
if (generatorString != null) {
|
||||
config.setProperty("worlds." + this.name + ".generator", this.generator);
|
||||
@ -63,9 +68,6 @@ public class MVWorld {
|
||||
}
|
||||
config.setProperty("worlds." + this.name + ".environment", this.environment.toString());
|
||||
|
||||
// Initialize our lists
|
||||
this.initLists();
|
||||
|
||||
// Set local values that CAN be changed by the user
|
||||
this.setAlias(config.getString("worlds." + this.name + ".alias", ""));
|
||||
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.getMobExceptions();
|
||||
|
||||
this.playerWhitelist = config.getStringList("worlds." + this.name + ".playerwhitelist", this.playerWhitelist);
|
||||
this.playerBlacklist = config.getStringList("worlds." + this.name + ".playerblacklist", this.playerBlacklist);
|
||||
this.worldBlacklist = config.getStringList("worlds." + this.name + ".worldblacklist", this.worldBlacklist);
|
||||
this.blockBlacklist = config.getIntList("worlds." + this.name + ".blockblacklist", this.blockBlacklist);
|
||||
this.editWhitelist = config.getStringList("worlds." + this.name + ".editwhitelist", this.editWhitelist);
|
||||
this.editBlacklist = config.getStringList("worlds." + this.name + ".editblacklist", this.editBlacklist);
|
||||
this.getPlayerWhitelist().addAll(config.getStringList("worlds." + this.name + ".playerwhitelist", new ArrayList<String>()));
|
||||
this.getPlayerBlacklist().addAll(config.getStringList("worlds." + this.name + ".playerblacklist", new ArrayList<String>()));
|
||||
this.getWorldBlacklist().addAll(config.getStringList("worlds." + this.name + ".worldblacklist", new ArrayList<String>()));
|
||||
this.getBlockBlacklist().addAll(config.getIntList("worlds." + this.name + ".blockblacklist", new ArrayList<Integer>()));
|
||||
this.getEditWhitelist().addAll(config.getStringList("worlds." + this.name + ".editwhitelist", new ArrayList<String>()));
|
||||
this.getEditBlacklist().addAll(config.getStringList("worlds." + this.name + ".editblacklist", new ArrayList<String>()));
|
||||
|
||||
config.save();
|
||||
// The following 3 lines will add some sample data to new worlds created.
|
||||
@ -91,16 +93,16 @@ public class MVWorld {
|
||||
|
||||
private void getMobExceptions() {
|
||||
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
|
||||
this.animalList.clear();
|
||||
|
||||
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
|
||||
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.blockBlacklist = new ArrayList<Integer>();
|
||||
// Only int list, we don't need to add it to the masterlist
|
||||
this.playerWhitelist = new ArrayList<String>();
|
||||
this.masterList.put("playerwhitelist", this.playerWhitelist);
|
||||
this.playerBlacklist = new ArrayList<String>();
|
||||
this.masterList.put("playerblacklist", this.playerBlacklist);
|
||||
this.editWhitelist = new ArrayList<String>();
|
||||
this.masterList.put("editwhitelist", this.editWhitelist);
|
||||
this.editBlacklist = new ArrayList<String>();
|
||||
this.masterList.put("editblacklist", this.editBlacklist);
|
||||
this.worldBlacklist = new ArrayList<String>();
|
||||
this.masterList.put("worldblacklist", this.worldBlacklist);
|
||||
this.masterList.put("playerwhitelist", new ArrayList<String>());
|
||||
this.masterList.put("playerblacklist", new ArrayList<String>());
|
||||
this.masterList.put("editwhitelist", new ArrayList<String>());
|
||||
this.masterList.put("editblacklist", new ArrayList<String>());
|
||||
this.masterList.put("worldblacklist", new ArrayList<String>());
|
||||
this.masterList.put("animals", new ArrayList<String>());
|
||||
this.masterList.put("monsters", new ArrayList<String>());
|
||||
}
|
||||
|
||||
public void addSampleData() {
|
||||
this.monsterList.add("creeper");
|
||||
this.getMonsterList().add("creeper");
|
||||
|
||||
this.animalList.add("pig");
|
||||
this.getAnimalList().add("pig");
|
||||
|
||||
this.blockBlacklist.add(49);
|
||||
|
||||
this.playerWhitelist.add("fernferret");
|
||||
this.playerWhitelist.add("g:Admins");
|
||||
this.getPlayerWhitelist().add("fernferret");
|
||||
this.getPlayerBlacklist().add("g:Admins");
|
||||
|
||||
this.playerBlacklist.add("Rigby90");
|
||||
this.playerBlacklist.add("g:Banned");
|
||||
this.getPlayerBlacklist().add("Rigby90");
|
||||
this.getPlayerBlacklist().add("g:Banned");
|
||||
|
||||
this.editWhitelist.add("fernferret");
|
||||
this.editWhitelist.add("g:Admins");
|
||||
this.getEditWhitelist().add("fernferret");
|
||||
this.getEditWhitelist().add("g:Admins");
|
||||
|
||||
this.editBlacklist.add("Rigby90");
|
||||
this.editBlacklist.add("g:Banned");
|
||||
this.getEditBlacklist().add("Rigby90");
|
||||
this.getEditBlacklist().add("g:Banned");
|
||||
|
||||
this.worldBlacklist.add("world5");
|
||||
this.worldBlacklist.add("A world with spaces");
|
||||
this.getWorldBlacklist().add("world5");
|
||||
this.getWorldBlacklist().add("A world with spaces");
|
||||
|
||||
this.config.setProperty("worlds." + this.name + ".animals.exceptions", this.animalList);
|
||||
this.config.setProperty("worlds." + this.name + ".monsters.exceptions", this.monsterList);
|
||||
this.config.setProperty("worlds." + this.name + ".blockBlacklist", this.blockBlacklist);
|
||||
this.config.setProperty("worlds." + this.name + ".playerWhitelist", this.playerWhitelist);
|
||||
this.config.setProperty("worlds." + this.name + ".playerBlacklist", this.playerBlacklist);
|
||||
this.config.setProperty("worlds." + this.name + ".editWhitelist", this.editWhitelist);
|
||||
this.config.setProperty("worlds." + this.name + ".editBlacklist", this.editBlacklist);
|
||||
this.config.setProperty("worlds." + this.name + ".worldBlacklist", this.worldBlacklist);
|
||||
this.config.setProperty("worlds." + this.name + ".animals.exceptions", this.getAnimalList());
|
||||
this.config.setProperty("worlds." + this.name + ".monsters.exceptions", this.getMonsterList());
|
||||
this.config.setProperty("worlds." + this.name + ".blockblacklist", this.getBlockBlacklist());
|
||||
this.config.setProperty("worlds." + this.name + ".playerwhitelist", this.getPlayerWhitelist());
|
||||
this.config.setProperty("worlds." + this.name + ".playerblacklist", this.getPlayerBlacklist());
|
||||
this.config.setProperty("worlds." + this.name + ".editwhitelist", this.getEditWhitelist());
|
||||
this.config.setProperty("worlds." + this.name + ".editblacklist", this.getEditBlacklist());
|
||||
this.config.setProperty("worlds." + this.name + ".worldblacklist", this.getWorldBlacklist());
|
||||
this.config.save();
|
||||
}
|
||||
|
||||
public boolean clearVariable(String property) {
|
||||
if(property.equalsIgnoreCase("blockblacklist")) {
|
||||
if (property.equalsIgnoreCase("blockblacklist")) {
|
||||
this.blockBlacklist.clear();
|
||||
}
|
||||
else if (this.masterList.keySet().contains(property)) {
|
||||
} else if (this.masterList.keySet().contains(property)) {
|
||||
this.masterList.get(property).clear();
|
||||
} else {
|
||||
return false;
|
||||
@ -172,41 +170,74 @@ public class MVWorld {
|
||||
}
|
||||
|
||||
public boolean addToList(String list, String value) {
|
||||
if(list.equalsIgnoreCase("blockblacklist")) {
|
||||
try{
|
||||
System.out.print("Trying to add " + value + " to " + list);
|
||||
if (list.equalsIgnoreCase("blockblacklist")) {
|
||||
try {
|
||||
int intVal = Integer.parseInt(value);
|
||||
return addToList(list, intVal);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (this.masterList.keySet().contains(list)) {
|
||||
|
||||
} else if (this.masterList.keySet().contains(list)) {
|
||||
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();
|
||||
System.out.print(this.masterList.get(list));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeFromList(String list, String value) {
|
||||
if(list.equalsIgnoreCase("blockblacklist")) {
|
||||
try{
|
||||
if (list.equalsIgnoreCase("blockblacklist")) {
|
||||
try {
|
||||
int intVal = Integer.parseInt(value);
|
||||
return removeFromList(list, intVal);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (this.masterList.keySet().contains(list)) {
|
||||
|
||||
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();
|
||||
return true;
|
||||
}
|
||||
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) {
|
||||
if (list.equalsIgnoreCase("blockblacklist")) {
|
||||
this.blockBlacklist.add(value);
|
||||
@ -246,8 +277,10 @@ public class MVWorld {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the one people have access to. It'll handle the rest.
|
||||
*
|
||||
* @param name
|
||||
* @param value
|
||||
* @return
|
||||
@ -304,52 +337,41 @@ public class MVWorld {
|
||||
}
|
||||
|
||||
public Boolean hasAnimals() {
|
||||
return this.animals;
|
||||
return this.allowAnimals;
|
||||
}
|
||||
|
||||
private void setAnimals(Boolean 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 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);
|
||||
this.config.setProperty("worlds." + this.name + ".animals.spawn", animals);
|
||||
this.config.save();
|
||||
this.syncMobs();
|
||||
}
|
||||
|
||||
public List<String> getAnimalList() {
|
||||
return this.animalList;
|
||||
return this.masterList.get("animals");
|
||||
}
|
||||
|
||||
public Boolean hasMonsters() {
|
||||
return this.monsters;
|
||||
return this.allowMonsters;
|
||||
}
|
||||
|
||||
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 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.save();
|
||||
this.syncMobs();
|
||||
}
|
||||
|
||||
public List<String> getMonsterList() {
|
||||
return this.monsterList;
|
||||
return this.masterList.get("monsters");
|
||||
}
|
||||
|
||||
public Boolean getPvp() {
|
||||
@ -369,19 +391,23 @@ public class MVWorld {
|
||||
}
|
||||
|
||||
public List<String> getPlayerWhitelist() {
|
||||
return this.playerWhitelist;
|
||||
return this.masterList.get("playerwhitelist");
|
||||
}
|
||||
|
||||
public List<String> getPlayerBlacklist() {
|
||||
return this.playerBlacklist;
|
||||
return this.masterList.get("playerblacklist");
|
||||
}
|
||||
|
||||
public List<String> getEditWhitelist() {
|
||||
return this.editWhitelist;
|
||||
return this.masterList.get("editwhitelist");
|
||||
}
|
||||
|
||||
public List<String> getEditBlacklist() {
|
||||
return this.editBlacklist;
|
||||
return this.masterList.get("editblacklist");
|
||||
}
|
||||
|
||||
public List<String> getWorldBlacklist() {
|
||||
return this.masterList.get("worldblacklist");
|
||||
}
|
||||
|
||||
public Double getScaling() {
|
||||
|
@ -236,24 +236,24 @@ public class MultiverseCore extends JavaPlugin {
|
||||
if (world == null)
|
||||
continue;
|
||||
MVWorld mvworld = this.worlds.get(key);
|
||||
List<String> monsters = mvworld.monsterList;
|
||||
List<String> animals = mvworld.animalList;
|
||||
List<String> monsters = mvworld.getMonsterList();
|
||||
List<String> animals = mvworld.getAnimalList();
|
||||
System.out.print("Monster Size:" + monsters.size() + " - " + "Animal Size: " + animals.size());
|
||||
for (Entity e : world.getEntities()) {
|
||||
// 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 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();
|
||||
continue;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
String creature = e.toString().replaceAll("Craft", "");
|
||||
if (monsters.contains(creature.toUpperCase())) {
|
||||
if (mvworld.monsters) {
|
||||
if (mvworld.hasMonsters()) {
|
||||
System.out.print(creature + " - Removed");
|
||||
e.remove();
|
||||
continue;
|
||||
@ -263,17 +263,17 @@ public class MultiverseCore extends JavaPlugin {
|
||||
// Check against 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 (mvworld.animals == false && !(animals.size() > 0)) {
|
||||
if (mvworld.hasAnimals() == false && !(animals.size() > 0)) {
|
||||
e.remove();
|
||||
continue;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
String creature = e.toString().replaceAll("Craft", "");
|
||||
if (animals.contains(creature.toUpperCase())) {
|
||||
if (mvworld.animals) {
|
||||
if (mvworld.hasAnimals()) {
|
||||
e.remove();
|
||||
continue;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class CoordCommand extends BaseCommand {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
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 + "Direction: " + ChatColor.WHITE + this.locMan.getDirection(p.getLocation()));
|
||||
p.sendMessage(ChatColor.RED + "Block: " + ChatColor.WHITE + Material.getMaterial(p.getWorld().getBlockTypeIdAt(p.getLocation())));
|
||||
|
@ -48,10 +48,10 @@ public class InfoCommand extends BaseCommand {
|
||||
ArrayList<String[]> pagedInfo = new ArrayList<String[]>();
|
||||
String[] aPage = new String[3];
|
||||
// World Name: 1
|
||||
aPage[0] = "World: " + world.name;
|
||||
aPage[0] = "World: " + world.getName();
|
||||
|
||||
// World Scale: 1
|
||||
aPage[1] = "World Scale: " + world.scaling;
|
||||
aPage[1] = "World Scale: " + world.getScaling();
|
||||
|
||||
// PVP: 1
|
||||
aPage[2] = "PVP: " + world.getPvp();
|
||||
|
@ -47,7 +47,7 @@ public class ListCommand extends BaseCommand {
|
||||
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");
|
||||
|
@ -18,7 +18,7 @@ enum Action {
|
||||
// This will contain all the properties that support the ADD/REMOVE
|
||||
// Anything not in here will only support the SET action
|
||||
enum AddProperties {
|
||||
animallist, monsterlist, blockblacklist, playerwhitelist, playerblacklist, editwhitelist, editblacklist, worldblacklist
|
||||
animallist, monsterlist, blockblacklist, playerwhitelist, playerblacklist, editwhitelist, editblacklist, worldblacklist, animals, monsters
|
||||
}
|
||||
|
||||
enum SetProperties {
|
||||
@ -92,9 +92,8 @@ public class ModifyCommand extends BaseCommand {
|
||||
} else {
|
||||
sender.sendMessage("There was an error setting " + property);
|
||||
}
|
||||
return;
|
||||
} else if (action == Action.Add) {
|
||||
if (world.removeFromList(property, value)) {
|
||||
if (world.addToList(property, value)) {
|
||||
sender.sendMessage(value + " was added to " + property);
|
||||
} else {
|
||||
sender.sendMessage(value + " could not be added to " + property);
|
||||
|
@ -49,11 +49,11 @@ public class WhoCommand extends BaseCommand {
|
||||
}
|
||||
|
||||
for (MVWorld world : worlds) {
|
||||
if (!(this.plugin.isMVWorld(world.name))) {
|
||||
if (!(this.plugin.isMVWorld(world.getName()))) {
|
||||
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))) {
|
||||
continue;
|
||||
}
|
||||
@ -77,7 +77,7 @@ public class WhoCommand extends BaseCommand {
|
||||
result += player.getName() + " ";
|
||||
}
|
||||
}
|
||||
sender.sendMessage(color + world.name + ChatColor.WHITE + " - " + result);
|
||||
sender.sendMessage(color + world.getName() + ChatColor.WHITE + " - " + result);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user