diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/CustomCreatures.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/CustomCreatures.java index b97ecbc2c..8dfc6ee3a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/CustomCreatures.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/CustomCreatures.java @@ -1,23 +1,18 @@ package mineplex.game.clans.gameplay; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; - -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.entity.HumanEntity; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.inventory.CraftItemEvent; -import org.bukkit.inventory.Recipe; +import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; public class CustomCreatures implements Listener { private static final EntityType[] DISABLED_CREATURES = { EntityType.WITCH, EntityType.PIG_ZOMBIE, - EntityType.HORSE, EntityType.ENDERMAN }; + EntityType.ENDERMAN }; + + private static final EntityType[] DISABLED_NATURAL = { EntityType.HORSE }; @EventHandler public void onCreatureSpawn(CreatureSpawnEvent event) @@ -26,6 +21,10 @@ public class CustomCreatures implements Listener { event.setCancelled(true); } + if (isDisabledNatural(event.getEntityType()) && event.getSpawnReason() != SpawnReason.CUSTOM) + { + event.setCancelled(true); + } } private boolean isDisabledCreature(EntityType entityType) @@ -40,4 +39,17 @@ public class CustomCreatures implements Listener return false; } -} + + private boolean isDisabledNatural(EntityType entityType) + { + for (EntityType disabledCreature : DISABLED_NATURAL) + { + if (disabledCreature == entityType) + { + return true; + } + } + + return false; + } +} \ No newline at end of file