diff options
author | feildmaster <admin@feildmaster.com> | 2012-03-10 18:43:35 -0600 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-11 16:31:11 -0400 |
commit | 06b814fd7ee1a147dc82870ccade90c4ac621059 (patch) | |
tree | c61e10a4735ab547290c4f080412f595890d760e | |
parent | 69ee00b6f01fef1d2056c57fc79cd5b33af4d273 (diff) | |
download | craftbukkit-06b814fd7ee1a147dc82870ccade90c4ac621059.tar craftbukkit-06b814fd7ee1a147dc82870ccade90c4ac621059.tar.gz craftbukkit-06b814fd7ee1a147dc82870ccade90c4ac621059.tar.lz craftbukkit-06b814fd7ee1a147dc82870ccade90c4ac621059.tar.xz craftbukkit-06b814fd7ee1a147dc82870ccade90c4ac621059.zip |
[Bleeding] Added EntityBreakDoorEvent. Fixes BUKKIT-1134
-rw-r--r-- | src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java | 6 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java index 97be70cd..c5bf0c0b 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java @@ -30,6 +30,12 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract { } if (--this.i == 0 && this.a.world.difficulty == 3) { + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreakDoorEvent(this.a, this.b, this.c, this.d).isCancelled()) { + this.c(); + return; + } + // CraftBukkit end this.a.world.setTypeId(this.b, this.c, this.d, 0); this.a.world.triggerEffect(1012, this.b, this.c, this.d, 0); this.a.world.triggerEffect(2001, this.b, this.c, this.d, this.e.id); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 9684591a..d6550e81 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -441,6 +441,16 @@ public class CraftEventFactory { return event; } + public static EntityBreakDoorEvent callEntityBreakDoorEvent(Entity entity, int x, int y, int z) { + org.bukkit.entity.Entity entity1 = entity.getBukkitEntity(); + Block block = entity1.getWorld().getBlockAt(x, y, z); + + EntityBreakDoorEvent event = new EntityBreakDoorEvent((LivingEntity) entity1, block); + entity1.getServer().getPluginManager().callEvent(event); + + return event; + } + public static Container callInventoryOpenEvent(EntityPlayer player, Container container) { if (player.activeContainer != player.defaultContainer) { // fire INVENTORY_CLOSE if one already open player.netServerHandler.handleContainerClose(new Packet101CloseWindow(player.activeContainer.windowId)); |