Added configurable animal and monster ticks per spawn setting.

By: EvilSeph <evilseph@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2012-02-10 10:23:52 -05:00
parent 712381a946
commit 1bbc68df3d
3 changed files with 38 additions and 0 deletions

View file

@ -357,6 +357,14 @@ public final class CraftServer implements Server {
return this.configuration.getInt("settings.ping-packet-limit", 100); return this.configuration.getInt("settings.ping-packet-limit", 100);
} }
public int getTicksPerAnimalSpawns() {
return this.configuration.getInt("ticks-per.animal-spawns");
}
public int getTicksPerMonsterSpawns() {
return this.configuration.getInt("ticks-per.monster-spawns");
}
public PluginManager getPluginManager() { public PluginManager getPluginManager() {
return pluginManager; return pluginManager;
} }
@ -410,6 +418,17 @@ public final class CraftServer implements Server {
for (WorldServer world : console.worlds) { for (WorldServer world : console.worlds) {
world.difficulty = difficulty; world.difficulty = difficulty;
world.setSpawnFlags(monsters, animals); world.setSpawnFlags(monsters, animals);
if (this.getTicksPerAnimalSpawns() < 0) {
world.ticksPerAnimalSpawns = 400;
} else {
world.ticksPerAnimalSpawns = this.getTicksPerAnimalSpawns();
}
if (this.getTicksPerMonsterSpawns() < 0) {
world.ticksPerMonsterSpawns = 1;
} else {
world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns();
}
} }
pluginManager.clearPlugins(); pluginManager.clearPlugins();

View file

@ -982,4 +982,20 @@ public class CraftWorld implements World {
public boolean canGenerateStructures() { public boolean canGenerateStructures() {
return world.getWorldData().o(); return world.getWorldData().o();
} }
public long getTicksPerAnimalSpawns() {
return world.ticksPerAnimalSpawns;
}
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
world.ticksPerAnimalSpawns = ticksPerAnimalSpawns;
}
public long getTicksPerMonsterSpawns() {
return world.ticksPerMonsterSpawns;
}
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
world.ticksPerMonsterSpawns = ticksPerMonsterSpawns;
}
} }

View file

@ -21,6 +21,9 @@ settings:
update-folder: update update-folder: update
ping-packet-limit: 100 ping-packet-limit: 100
use-exact-login-location: false use-exact-login-location: false
ticks-per:
animal-spawns: 400
monster-spawns: 1
aliases: aliases:
icanhasbukkit: icanhasbukkit:
- version - version