@@ -104,7 +104,7 @@ private List<List<FancyText>> buildEntireCommand(MVWorld world, Player p) {
//message.add(new FancyMessage("Game Mode: ", StringUtils.capitalize(world.getGameMode().toString()), colors));
Location spawn = world.getSpawnLocation();
message.add(new FancyMessage("Spawn Location: ", LocationManipulation.strCoords(spawn), colors));
message.add(new FancyMessage("World Scale: ", world.getScaling().toString(), colors));
message.add(new FancyMessage("World Scale: ", world.getScaling() + "", colors));
if (world.getPrice() > 0) {
message.add(new FancyMessage("Price to enter this world: ", this.plugin.getBank().getFormattedAmount(p, world.getPrice(), world.getCurrency()), colors));
} else {
@@ -130,43 +130,43 @@ private List<List<FancyText>> buildEntireCommand(MVWorld world, Player p) {
message.add(new FancyMessage("Players will get hungry: ", world.getHunger() + "", colors));
message.add(new FancyMessage("Keep spawn in memory: ", world.isKeepingSpawnInMemory() + "", colors));
message.add(new FancyHeader("PVP Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.getPvp().toString(), colors));
message.add(new FancyMessage("Multiverse Setting: ", world.isPVPEnabled() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getPVP() + "", colors));
message.add(new FancyMessage("Fake PVP Enabled: ", world.getFakePVP() + "", colors));
worldInfo.add(message);
// Page 3
message = new ArrayList<FancyText>();
message.add(new FancyHeader("Monster Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.allowMonsterSpawning() + "", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.canMonstersSpawn() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowMonsters() + "", colors));
if (MultiverseCore.MobsDisabledInDefaultWorld) {
message.add(new FancyMessage(ChatColor.RED + "WARNING: ", "Monsters WILL NOT SPAWN IN THIS WORLD.", colors));
message.add(new FancyMessage(ChatColor.RED + "WARNING: ", "Check your server log for more details.", colors));
}
if (world.getMonsterList().size() > 0) {
if (world.allowMonsterSpawning()) {
if (world.canMonstersSpawn()) {
message.add(new FancyMessage("Monsters that" + ChatColor.RED + " CAN NOT " + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getMonsterList()), colors));
} else {
message.add(new FancyMessage("Monsters that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getMonsterList()), colors));
}
} else {
message.add(new FancyMessage("Monsters that CAN spawn: ", world.allowMonsterSpawning() ? "ALL" : "NONE", colors));
message.add(new FancyMessage("Monsters that CAN spawn: ", world.canMonstersSpawn() ? "ALL" : "NONE", colors));
}
worldInfo.add(message);

// Page 4
message = new ArrayList<FancyText>();
message.add(new FancyHeader("Animal Settings", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.allowAnimalSpawning() + "", colors));
message.add(new FancyMessage("Multiverse Setting: ", world.canAnimalsSpawn() + "", colors));
message.add(new FancyMessage("Bukkit Setting: ", world.getCBWorld().getAllowAnimals() + "", colors));
if (world.getMonsterList().size() > 0) {
if (world.allowMonsterSpawning()) {
if (world.canMonstersSpawn()) {
message.add(new FancyMessage("Animals that" + ChatColor.RED + " CAN NOT " + ChatColor.GREEN + "spawn: ", toCommaSeperated(world.getAnimalList()), colors));
} else {
message.add(new FancyMessage("Animals that" + ChatColor.GREEN + " CAN SPAWN: ", toCommaSeperated(world.getAnimalList()), colors));
}
} else {
message.add(new FancyMessage("Animals that CAN spawn: ", world.allowAnimalSpawning() ? "ALL" : "NONE", colors));
message.add(new FancyMessage("Animals that CAN spawn: ", world.canAnimalsSpawn() ? "ALL" : "NONE", colors));
}
worldInfo.add(message);

@@ -59,8 +59,8 @@ public void onEntityDamage(EntityDamageEvent event) {
if (event.isCancelled()) {
return;
}
Entity attacker = null;
Entity defender = null;
Entity attacker;
Entity defender;
if (event instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event;
attacker = sub.getDamager();
@@ -82,10 +82,8 @@ public void onEntityDamage(EntityDamageEvent event) {
MVWorld world = this.worldManager.getMVWorld(w.getName());

if (attacker instanceof Player) {
Player pattacker = (Player) attacker;

if (!world.getPvp() && this.plugin.getConfig().getBoolean("fakepvp", false)) {
pattacker.sendMessage(ChatColor.RED + "PVP is disabled in this World.");
if (!world.isPVPEnabled() && this.plugin.getConfig().getBoolean("fakepvp", false)) {
((Player) attacker).sendMessage(ChatColor.RED + "PVP is disabled in this World.");
event.setCancelled(true);
}
}
@@ -136,13 +134,13 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
* Animal Handling
*/
if (event.getEntity() instanceof Animals || event.getEntity() instanceof Squid) {
event.setCancelled(this.shouldWeKillThisCreature(mvworld.getAnimalList(), mvworld.allowAnimalSpawning(), creature.toString().toUpperCase()));
event.setCancelled(this.shouldWeKillThisCreature(mvworld.getAnimalList(), mvworld.canAnimalsSpawn(), creature.toString().toUpperCase()));
}
/**
* Monster Handling
*/
if (event.getEntity() instanceof Monster || event.getEntity() instanceof Ghast || event.getEntity() instanceof Slime) {
event.setCancelled(this.shouldWeKillThisCreature(mvworld.getMonsterList(), mvworld.allowMonsterSpawning(), creature.toString().toUpperCase()));
event.setCancelled(this.shouldWeKillThisCreature(mvworld.getMonsterList(), mvworld.canMonstersSpawn(), creature.toString().toUpperCase()));
}
}

@@ -156,13 +154,13 @@ private boolean shouldWeKillThisCreature(List<String> creatureList, boolean allo
} else if (creatureList.contains(creature) && allowCreatureSpawning) {
// 3. There ARE exceptions and animals ARE allowed. Kill it.
return true;
} else if (!creatureList.contains(creature.toString().toUpperCase()) && allowCreatureSpawning) {
} else if (!creatureList.contains(creature.toUpperCase()) && allowCreatureSpawning) {
// 4. There ARE exceptions and animals ARE NOT allowed. SAVE it.
return false;
} else if (creatureList.contains(creature.toString().toUpperCase()) && !allowCreatureSpawning) {
} else if (creatureList.contains(creature.toUpperCase()) && !allowCreatureSpawning) {
// 5. No animals are allowed to be spawned, BUT this one can stay...
return false;
} else if (!creatureList.contains(creature.toString().toUpperCase()) && !allowCreatureSpawning) {
} else if (!creatureList.contains(creature.toUpperCase()) && !allowCreatureSpawning) {
// 6. Animals are NOT allowed to spawn, and this creature is not in the save list... KILL IT
return true;
}
@@ -51,7 +51,7 @@ public void purgeWorld(CommandSender sender, MVWorld world) {
}
ArrayList<String> allMobs = new ArrayList<String>(world.getAnimalList());
allMobs.addAll(world.getMonsterList());
purgeWorld(sender, world, allMobs, !world.allowAnimalSpawning(), !world.allowMonsterSpawning());
purgeWorld(sender, world, allMobs, !world.canAnimalsSpawn(), !world.canMonstersSpawn());
}

public void purgeWorld(CommandSender sender, MVWorld mvworld, List<String> thingsToKill, boolean negateAnimals, boolean negateMonsters) {
@@ -168,8 +168,8 @@ public boolean unloadWorld(String name) {
}

public boolean loadWorld(String name) {
// Check if the World is already loaded
if (this.worlds.containsKey(name)) {
// Check if the World is already loaded
if (this.worlds.containsKey(name)) {
return true;
}

@@ -186,9 +186,8 @@ public boolean loadWorld(String name) {
addWorld(name, this.plugin.getEnvFromString(environment), seedString, generatorString);

return true;
}
else {
return false;
} else {
return false;
}
}

@@ -289,6 +288,14 @@ public MVWorld getMVWorld(String name) {
return this.getMVWorldByAlias(name);
}

@Override
public MVWorld getMVWorld(World world) {
if (world != null) {
return this.getMVWorld(world.getName());
}
return null;
}

/**
* Returns a {@link MVWorld} if it exists, and null if it does not. This will search ONLY alias.
*
@@ -317,6 +324,18 @@ public boolean isMVWorld(String name) {
return (this.worlds.containsKey(name) || isMVWorldAlias(name));
}

/**
* Checks to see if the given world is a valid {@link com.onarandombox.MultiverseCore.MVWorld}
*
* @param world The Bukkit world to check.
*
* @return True if the world has been loaded into MV2, false if not.
*/
@Override
public boolean isMVWorld(World world) {
return world != null && this.isMVWorld(world.getName());
}

/**
* This method ONLY checks the alias of each world.
*