Basic implementation of the spawn in memory setting.

This commit is contained in:
Rigby 2011-08-05 05:12:07 +01:00
parent 01b016f002
commit 6e1cff5d26
2 changed files with 16 additions and 4 deletions

View File

@ -74,6 +74,8 @@ public class MVWorld {
private boolean allowAnimals; // Does this World allow Animals to Spawn?
private boolean allowMonsters; // Does this World allow Monsters to Spawn?
private boolean keepSpawnInMemory; // Does the World have the spawn loaded all the time?
private Boolean pvp; // Does this World allow PVP?
private Boolean fakepvp; // Should this world have fakePVP on? (used for PVP zones)
@ -131,6 +133,8 @@ public class MVWorld {
this.setCurrency(config.getInt("worlds." + this.name + ".entryfee.currency", -1));
this.getMobExceptions();
this.setSpawnInMemory(config.getBoolean("worlds." + this.name + ".keepspawninmemory", true));
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.translateTempSpawn(config);
@ -338,16 +342,24 @@ public class MVWorld {
if (name.equalsIgnoreCase("pvp")) {
this.setPvp(value);
} else if (name.equalsIgnoreCase("animals")) {
this.setAnimals(value);
} else if (name.equalsIgnoreCase("monsters")) {
this.setMonsters(value);
} else if (name.equalsIgnoreCase("memory") || name.equalsIgnoreCase("spawnmemory")) {
this.setSpawnInMemory(value);
} else {
return false;
return false;
}
return true;
}
private void setSpawnInMemory(boolean value) {
this.world.setKeepSpawnInMemory(value);
this.keepSpawnInMemory = value;
this.config.setProperty("worlds." + this.name + ".keepspawninmemory", value);
saveConfig();
}
private boolean setVariable(String name, double value) {
if (name.equalsIgnoreCase("scaling") || name.equalsIgnoreCase("scale")) {
this.setScaling(value);
@ -363,7 +375,7 @@ public class MVWorld {
/**
* This is the one people have access to. It'll handle the rest.
*
*
* @param name
* @param value
* @return

View File

@ -21,7 +21,7 @@ enum Action {
// Color == Aliascolor
enum SetProperties {
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale, spawnmemory, memory
}
public class ModifyCommand extends MultiverseCommand {