mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-09-18 18:41:35 +02:00
Add Minecraft behavior to multiple worlds
If a world has NO exceptions, and has monsters/animals turned off, we should not even try and spawn them, or at least tell Bukkit to do this.
This commit is contained in:
parent
63a2fc0f1f
commit
dc2a8309bc
@ -47,7 +47,7 @@ public class MVWorld {
|
|||||||
this.environment = env;
|
this.environment = env;
|
||||||
this.seed = seed;
|
this.seed = seed;
|
||||||
|
|
||||||
initLists();
|
this.initLists();
|
||||||
|
|
||||||
this.alias = config.getString("worlds." + this.name + ".alias", "");
|
this.alias = config.getString("worlds." + this.name + ".alias", "");
|
||||||
|
|
||||||
@ -70,18 +70,12 @@ public class MVWorld {
|
|||||||
this.animals = config.getBoolean("worlds." + name + ".animals.spawn", true);
|
this.animals = config.getBoolean("worlds." + name + ".animals.spawn", true);
|
||||||
this.monsters = config.getBoolean("worlds." + name + ".monsters.spawn", true);
|
this.monsters = config.getBoolean("worlds." + name + ".monsters.spawn", true);
|
||||||
|
|
||||||
List<String> temp;
|
|
||||||
temp = config.getStringList("worlds." + name + ".animals.exceptions", animalList);
|
|
||||||
this.animalList.clear();
|
this.getMobExceptions();
|
||||||
for (String s : temp) {
|
|
||||||
this.animalList.add(s.toUpperCase());
|
this.setRealMobBehaviors();
|
||||||
//System.out.print(s);
|
|
||||||
}
|
|
||||||
temp = config.getStringList("worlds." + name + ".monsters.exceptions", monsterList);
|
|
||||||
for (String s : temp) {
|
|
||||||
this.monsterList.add(s.toUpperCase());
|
|
||||||
//System.out.print(s);
|
|
||||||
}
|
|
||||||
config.setProperty("worlds." + this.name + ".environment", env);
|
config.setProperty("worlds." + this.name + ".environment", env);
|
||||||
if(seed != null) {
|
if(seed != null) {
|
||||||
config.setProperty("worlds." + this.name + ".seed", this.seed);
|
config.setProperty("worlds." + this.name + ".seed", this.seed);
|
||||||
@ -93,6 +87,34 @@ public class MVWorld {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getMobExceptions() {
|
||||||
|
List<String> temp;
|
||||||
|
temp = this.config.getStringList("worlds." + name + ".animals.exceptions", animalList);
|
||||||
|
// Add Animals to the exclusion list
|
||||||
|
this.animalList.clear();
|
||||||
|
for (String s : temp) {
|
||||||
|
this.animalList.add(s.toUpperCase());
|
||||||
|
}
|
||||||
|
temp = this.config.getStringList("worlds." + name + ".monsters.exceptions", monsterList);
|
||||||
|
// Add Monsters to the exclusion list
|
||||||
|
for (String s : temp) {
|
||||||
|
this.monsterList.add(s.toUpperCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setRealMobBehaviors() {
|
||||||
|
boolean animals = true;
|
||||||
|
boolean monsters = true;
|
||||||
|
if(!this.animals && this.animalList.isEmpty()) {
|
||||||
|
animals = false;
|
||||||
|
}
|
||||||
|
if(!this.monsters && this.monsterList.isEmpty()) {
|
||||||
|
monsters = false;
|
||||||
|
}
|
||||||
|
this.world.setSpawnFlags(monsters, animals);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void initLists() {
|
private void initLists() {
|
||||||
blockBlacklist = new ArrayList<Integer>();
|
blockBlacklist = new ArrayList<Integer>();
|
||||||
playerWhitelist = new ArrayList<String>();
|
playerWhitelist = new ArrayList<String>();
|
||||||
|
Loading…
Reference in New Issue
Block a user