From 28fdb0d055cc80c41556298e440bc49e74a1413e Mon Sep 17 00:00:00 2001 From: Georgiy Date: Sun, 30 Jun 2013 20:38:14 -0400 Subject: [PATCH] Added to SheepDeshearer to prevent sheep from breeding. --- src/gibstick/bukkit/discosheep/SheepDeshearer.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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); + } + } + } + } }