diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-10-31 11:18:41 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-10-31 13:01:48 -0400 |
commit | f479aa84a467f8b684d9f8885165a4ef891def13 (patch) | |
tree | 78f1245e639c52c3864f9b27354e4559413d477f /src/main/java/org/bukkit | |
parent | 46d7cd1e0502edbbca323b2a289a49fbf951628d (diff) | |
download | craftbukkit-f479aa84a467f8b684d9f8885165a4ef891def13.tar craftbukkit-f479aa84a467f8b684d9f8885165a4ef891def13.tar.gz craftbukkit-f479aa84a467f8b684d9f8885165a4ef891def13.tar.lz craftbukkit-f479aa84a467f8b684d9f8885165a4ef891def13.tar.xz craftbukkit-f479aa84a467f8b684d9f8885165a4ef891def13.zip |
Implement API for ambient mob spawn limit. Add spawn-limit.ambient to
bukkit.yml. Adds BUKKIT-2765
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftServer.java | 7 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 33bdc122..94b2c760 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -155,6 +155,7 @@ public final class CraftServer implements Server { private int monsterSpawn = -1; private int animalSpawn = -1; private int waterAnimalSpawn = -1; + private int ambientSpawn = -1; private File container; private WarningState warningState = WarningState.DEFAULT; @@ -190,6 +191,7 @@ public final class CraftServer implements Server { monsterSpawn = configuration.getInt("spawn-limits.monsters"); animalSpawn = configuration.getInt("spawn-limits.animals"); waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals"); + ambientSpawn = configuration.getInt("spawn-limits.ambient"); console.autosavePeriod = configuration.getInt("ticks-per.autosave"); warningState = WarningState.value(configuration.getString("settings.deprecated-verbose")); @@ -526,6 +528,7 @@ public final class CraftServer implements Server { monsterSpawn = configuration.getInt("spawn-limits.monsters"); animalSpawn = configuration.getInt("spawn-limits.animals"); waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals"); + ambientSpawn = configuration.getInt("spawn-limits.ambient"); warningState = WarningState.value(configuration.getString("settings.deprecated-verbose")); console.autosavePeriod = configuration.getInt("ticks-per.autosave"); @@ -1236,6 +1239,10 @@ public final class CraftServer implements Server { return waterAnimalSpawn; } + public int getAmbientSpawnLimit() { + return ambientSpawn; + } + public boolean isPrimaryThread() { return Thread.currentThread().equals(console.primaryThread); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 5855b549..45091168 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -57,6 +57,7 @@ public class CraftWorld implements World { private int monsterSpawn = -1; private int animalSpawn = -1; private int waterAnimalSpawn = -1; + private int ambientSpawn = -1; private static final Random rand = new Random(); @@ -1188,6 +1189,19 @@ public class CraftWorld implements World { waterAnimalSpawn = limit; } + public int getAmbientSpawnLimit() { + if (ambientSpawn < 0) { + return server.getAmbientSpawnLimit(); + } + + return ambientSpawn; + } + + public void setAmbientSpawnLimit(int limit) { + ambientSpawn = limit; + } + + public void playSound(Location loc, Sound sound, float volume, float pitch) { if (loc == null || sound == null) return; |