From d4a9e5ab841bfae67e4260c19c1ff4cf4e019f6c Mon Sep 17 00:00:00 2001 From: Esophose Date: Thu, 15 Aug 2019 11:06:46 -0600 Subject: [PATCH] Fix spider jockeys spawning skeletons even if natural spawning disabled --- .../me/goodandevil/skyblock/listeners/Entity.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/FabledSkyBlock/Core/src/main/java/me/goodandevil/skyblock/listeners/Entity.java b/FabledSkyBlock/Core/src/main/java/me/goodandevil/skyblock/listeners/Entity.java index b6cb143e..ae5ff9ed 100644 --- a/FabledSkyBlock/Core/src/main/java/me/goodandevil/skyblock/listeners/Entity.java +++ b/FabledSkyBlock/Core/src/main/java/me/goodandevil/skyblock/listeners/Entity.java @@ -662,7 +662,7 @@ public class Entity implements Listener { return; } - if (event.getSpawnReason() != SpawnReason.NATURAL) + if (!(event.getSpawnReason() == SpawnReason.NATURAL || event.getSpawnReason() == SpawnReason.JOCKEY || event.getSpawnReason() == SpawnReason.MOUNT)) return; LivingEntity livingEntity = event.getEntity(); @@ -672,7 +672,15 @@ public class Entity implements Listener { if (skyblock.getWorldManager().isIslandWorld(livingEntity.getWorld())) { if (!skyblock.getIslandManager().hasSetting(livingEntity.getLocation(), IslandRole.Owner, "NaturalMobSpawning")) { - livingEntity.remove(); + if (event.getSpawnReason() == SpawnReason.JOCKEY || event.getSpawnReason() == SpawnReason.MOUNT) { + Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> { + for (org.bukkit.entity.Entity passenger : livingEntity.getPassengers()) + passenger.remove(); + livingEntity.remove(); + }); + } else { + livingEntity.remove(); + } } } }