1.10- support for natural spawning disable

This commit is contained in:
Esophose 2019-08-15 11:21:20 -06:00
parent d4a9e5ab84
commit 70374c7a7c

View File

@ -674,8 +674,13 @@ public class Entity implements Listener {
if (!skyblock.getIslandManager().hasSetting(livingEntity.getLocation(), IslandRole.Owner, "NaturalMobSpawning")) { if (!skyblock.getIslandManager().hasSetting(livingEntity.getLocation(), IslandRole.Owner, "NaturalMobSpawning")) {
if (event.getSpawnReason() == SpawnReason.JOCKEY || event.getSpawnReason() == SpawnReason.MOUNT) { if (event.getSpawnReason() == SpawnReason.JOCKEY || event.getSpawnReason() == SpawnReason.MOUNT) {
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> { Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, () -> {
if (NMSUtil.getVersionNumber() > 10) { // getPassengers() was added in 1.11
for (org.bukkit.entity.Entity passenger : livingEntity.getPassengers()) for (org.bukkit.entity.Entity passenger : livingEntity.getPassengers())
passenger.remove(); passenger.remove();
} else {
if (livingEntity.getPassenger() != null)
livingEntity.getPassenger().remove();
}
livingEntity.remove(); livingEntity.remove();
}); });
} else { } else {