From e4567e091b25e831cf6a944cfbc35a8f63efff5f Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 31 Oct 2012 11:18:06 -0500 Subject: [PATCH] Add API for ambient mob spawn limit. Adds BUKKIT-2765 By: Travis Watkins --- paper-api/src/main/java/org/bukkit/Bukkit.java | 4 ++++ paper-api/src/main/java/org/bukkit/Server.java | 8 +++++++- paper-api/src/main/java/org/bukkit/World.java | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/Bukkit.java b/paper-api/src/main/java/org/bukkit/Bukkit.java index 56f091aab8..7e8478ae15 100644 --- a/paper-api/src/main/java/org/bukkit/Bukkit.java +++ b/paper-api/src/main/java/org/bukkit/Bukkit.java @@ -371,6 +371,10 @@ public final class Bukkit { return server.getWaterAnimalSpawnLimit(); } + public static int getAmbientSpawnLimit() { + return server.getAmbientSpawnLimit(); + } + public static boolean isPrimaryThread() { return server.isPrimaryThread(); } diff --git a/paper-api/src/main/java/org/bukkit/Server.java b/paper-api/src/main/java/org/bukkit/Server.java index 54cb1d9444..881d47f1c8 100644 --- a/paper-api/src/main/java/org/bukkit/Server.java +++ b/paper-api/src/main/java/org/bukkit/Server.java @@ -648,6 +648,12 @@ public interface Server extends PluginMessageRecipient { */ int getWaterAnimalSpawnLimit(); + /** + * Gets user-specified limit for number of ambient mobs that can spawn in a chunk + * @returns The ambient spawn limit + */ + int getAmbientSpawnLimit(); + /** * Returns true if the current {@link Thread} is the server's primary thread */ @@ -666,4 +672,4 @@ public interface Server extends PluginMessageRecipient { * @return The configured WarningState */ public WarningState getWarningState(); -} \ No newline at end of file +} diff --git a/paper-api/src/main/java/org/bukkit/World.java b/paper-api/src/main/java/org/bukkit/World.java index de49f4d7f2..ad6623e9e3 100644 --- a/paper-api/src/main/java/org/bukkit/World.java +++ b/paper-api/src/main/java/org/bukkit/World.java @@ -983,6 +983,20 @@ public interface World extends PluginMessageRecipient, Metadatable { */ void setWaterAnimalSpawnLimit(int limit); + /** + * Gets the limit for number of ambient mobs that can spawn in a chunk in this world + * @returns The ambient spawn limit + */ + int getAmbientSpawnLimit(); + + /** + * Sets the limit for number of ambient mobs that can spawn in a chunk in this world + *

+ * Note: + * If set to a negative number the world will use the server-wide spawn limit instead. + */ + void setAmbientSpawnLimit(int limit); + /** * Play a Sound at the provided Location in the World *