diff options
author | Aidan Matzko <amatzko48@gmail.com> | 2012-02-04 12:40:52 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-02-09 11:36:04 -0500 |
commit | 6dda89d8736316af459171e9fcc3e75b204569b0 (patch) | |
tree | a90a4a4c036b0839c986795c451fe5913df951e3 /src/main/java/net/minecraft/server/EntityEnderman.java | |
parent | 10ab7b96edb85c90dd480aa718a59d82682e091c (diff) | |
download | craftbukkit-6dda89d8736316af459171e9fcc3e75b204569b0.tar craftbukkit-6dda89d8736316af459171e9fcc3e75b204569b0.tar.gz craftbukkit-6dda89d8736316af459171e9fcc3e75b204569b0.tar.lz craftbukkit-6dda89d8736316af459171e9fcc3e75b204569b0.tar.xz craftbukkit-6dda89d8736316af459171e9fcc3e75b204569b0.zip |
[Bleeding] Deprecate Enderman events in favor of EntityChangeBlock
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityEnderman.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityEnderman.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java index f4809d88..66d8de44 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java @@ -8,6 +8,7 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.event.entity.EndermanPickupEvent; import org.bukkit.event.entity.EndermanPlaceEvent; import org.bukkit.event.entity.EntityTeleportEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; // CraftBukkit end public class EntityEnderman extends EntityMonster { @@ -108,9 +109,14 @@ public class EntityEnderman extends EntityMonster { l = this.world.getTypeId(i, j, k); if (b[l]) { // CraftBukkit start - pickup event + // TODO: We still call the old event EndermanPickupEvent pickup = new EndermanPickupEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j, k)); this.world.getServer().getPluginManager().callEvent(pickup); - if (!pickup.isCancelled()) { + + EntityChangeBlockEvent event = new EntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR); + this.world.getServer().getPluginManager().callEvent(event); + + if (!pickup.isCancelled() && !event.isCancelled()) { this.setCarriedId(this.world.getTypeId(i, j, k)); this.setCarriedData(this.world.getData(i, j, k)); this.world.setTypeId(i, j, k, 0); @@ -127,9 +133,14 @@ public class EntityEnderman extends EntityMonster { if (l == 0 && i1 > 0 && Block.byId[i1].b()) { // CraftBukkit start - place event + // TODO: We still call the old event EndermanPlaceEvent place = new EndermanPlaceEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), i, j, k)); this.world.getServer().getPluginManager().callEvent(place); - if (!place.isCancelled()) { + + EntityChangeBlockEvent event = new EntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR); + this.world.getServer().getPluginManager().callEvent(event); + + if (!place.isCancelled() && !event.isCancelled()) { this.world.setTypeIdAndData(i, j, k, this.getCarriedId(), this.getCarriedData()); this.setCarriedId(0); } |