From b759d006ed119ef45788180444c574912edb1a8e Mon Sep 17 00:00:00 2001 From: Jake Potrebic <15055071+Machine-Maker@users.noreply.github.com> Date: Tue, 8 Jun 2021 03:52:01 -0700 Subject: [PATCH] Adds per-world spawn limits (#4837) --- .../0758-add-per-world-spawn-limits.patch | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Spigot-Server-Patches/0758-add-per-world-spawn-limits.patch diff --git a/Spigot-Server-Patches/0758-add-per-world-spawn-limits.patch b/Spigot-Server-Patches/0758-add-per-world-spawn-limits.patch new file mode 100644 index 0000000000..0dcc7093e4 --- /dev/null +++ b/Spigot-Server-Patches/0758-add-per-world-spawn-limits.patch @@ -0,0 +1,49 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: chase +Date: Wed, 2 Dec 2020 22:43:39 -0800 +Subject: [PATCH] add per world spawn limits + +Taken from #2982. Credit to Chasewhip8 + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 5c91c007691efeea1d4383efcd1ca06990d0660c..fcacc08db8f5a58ddd06be7f9f2cb2cf6b2231c3 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -653,6 +653,19 @@ public class PaperWorldConfig { + zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance); + } + ++ public int spawnLimitMonsters = -1; ++ public int spawnLimitAnimals = -1; ++ public int spawnLimitWaterAnimals = -1; ++ public int spawnLimitWaterAmbient = -1; ++ public int spawnLimitAmbient = -1; ++ private void perWorldSpawnLimits() { ++ spawnLimitMonsters = getInt("spawn-limits.monsters", spawnLimitMonsters); ++ spawnLimitAnimals = getInt("spawn-limits.animals", spawnLimitAnimals); ++ spawnLimitWaterAnimals = getInt("spawn-limits.water-animals", spawnLimitWaterAnimals); ++ spawnLimitWaterAmbient = getInt("spawn-limits.water-ambient", spawnLimitWaterAmbient); ++ spawnLimitAmbient = getInt("spawn-limits.ambient", spawnLimitAmbient); ++ } ++ + public int lightQueueSize = 20; + private void lightQueueSize() { + lightQueueSize = getInt("light-queue-size", lightQueueSize); +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 02198dbe9e80c2990e8a09b2b763748dae727a03..c0b49a0eaeda06b89a4fb425eec3d5bfa9717379 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -353,6 +353,13 @@ public class CraftWorld implements World { + this.generator = gen; + + environment = env; ++ // Paper start - per world spawn limits ++ this.monsterSpawn = this.world.paperConfig.spawnLimitMonsters; ++ this.animalSpawn = this.world.paperConfig.spawnLimitAnimals; ++ this.waterAnimalSpawn = this.world.paperConfig.spawnLimitWaterAnimals; ++ this.waterAmbientSpawn = this.world.paperConfig.spawnLimitWaterAmbient; ++ this.ambientSpawn = this.world.paperConfig.spawnLimitAmbient; ++ // Paper end + } + + @Override