Adjusted CraftBukkit to work with the entity event convenience patch in Bukkit. Addresses BUKKIT-809

This commit is contained in:
TomyLobo
2012-02-21 13:51:56 +01:00
committed by EvilSeph
parent dcf016822d
commit 92dfb2500b
11 changed files with 59 additions and 63 deletions

View File

@@ -1,10 +1,5 @@
package net.minecraft.server;
// CraftBukkit start
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.PigZapEvent;
// CraftBukkit end
public class EntityPig extends EntityAnimal {
public EntityPig(World world) {
@@ -76,17 +71,14 @@ public class EntityPig extends EntityAnimal {
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
// CraftBukkit start
PigZapEvent event = new PigZapEvent(this.getBukkitEntity(), entityweatherlighting.getBukkitEntity(), entitypigzombie.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
if (org.bukkit.craftbukkit.event.CraftEventFactory.callPigZapEvent(this, entityweatherlighting, entitypigzombie).isCancelled()) {
return;
}
// CraftBukkit end
entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
// CraftBukkit - added a reason for spawning this creature
this.world.addEntity(entitypigzombie, SpawnReason.LIGHTNING);
this.world.addEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
this.die();
}
}