blocked all sheep damage

This commit is contained in:
Charlie Wang 2013-07-12 09:14:36 -04:00
parent bf698d4c6e
commit 6166c56f9c

View File

@ -7,6 +7,7 @@ package gibstick.bukkit.discosheep;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerShearEntityEvent;
/**
@ -31,4 +32,19 @@ public class BaaBaaBlockSheepEvents implements Listener {
}
}
}
// actually make sheep invincible
@EventHandler
public void onEntityDamageEvent(EntityDamageEvent e) {
if (e.getEntity() instanceof Sheep) {
for (DiscoParty party : parent.getParties()) {
if (party.getSheep().contains((Sheep) e.getEntity())) {
{
party.jumpSheep((Sheep) e.getEntity());
e.setCancelled(true);
}
}
}
}
}
}