Added to SheepDeshearer to prevent sheep from breeding.

This commit is contained in:
Georgiy 2013-06-30 20:38:14 -04:00
parent 8863b401c9
commit 28fdb0d055

View File

@ -4,10 +4,10 @@
*/ */
package gibstick.bukkit.discosheep; package gibstick.bukkit.discosheep;
import java.util.List;
import org.bukkit.entity.Sheep; import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.player.PlayerShearEntityEvent; 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);
}
}
}
}
} }