diff --git a/src/gibstick/bukkit/discosheep/SheepDeshearer.java b/src/gibstick/bukkit/discosheep/SheepDeshearer.java index 2df53a8..607cfd3 100644 --- a/src/gibstick/bukkit/discosheep/SheepDeshearer.java +++ b/src/gibstick/bukkit/discosheep/SheepDeshearer.java @@ -4,10 +4,10 @@ */ package gibstick.bukkit.discosheep; -import java.util.List; import org.bukkit.entity.Sheep; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.player.PlayerShearEntityEvent; /** @@ -32,4 +32,15 @@ public class SheepDeshearer implements Listener { } } } + + @EventHandler + public void onCreatureSpawn(CreatureSpawnEvent e){ + if(e.getEntity() instanceof Sheep){ + for(DiscoParty party : parent.getParties()){ + if(party.getSheep().contains((Sheep)e.getEntity())){ + e.setCancelled(true); + } + } + } + } }