diff options
author | Tahg <tahgtahv@gmail.com> | 2011-04-04 00:48:40 -0400 |
---|---|---|
committer | Tahg <tahgtahv@gmail.com> | 2011-04-04 01:07:39 -0400 |
commit | 7a99fd7327e39c8401078bb19b1b3f638f09eecb (patch) | |
tree | b0f644e75c71eb539c750826dda3bac9d61364d3 /src/main/java/net/minecraft/server/BlockPressurePlate.java | |
parent | d1e6408ea2a06e88cdfbadc585291812d179c52d (diff) | |
download | craftbukkit-7a99fd7327e39c8401078bb19b1b3f638f09eecb.tar craftbukkit-7a99fd7327e39c8401078bb19b1b3f638f09eecb.tar.gz craftbukkit-7a99fd7327e39c8401078bb19b1b3f638f09eecb.tar.lz craftbukkit-7a99fd7327e39c8401078bb19b1b3f638f09eecb.tar.xz craftbukkit-7a99fd7327e39c8401078bb19b1b3f638f09eecb.zip |
added some API for entities
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockPressurePlate.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockPressurePlate.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java index b5ce1bc6..b48bb22b 100644 --- a/src/main/java/net/minecraft/server/BlockPressurePlate.java +++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java @@ -8,8 +8,10 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.event.CraftEventFactory; +import org.bukkit.event.Cancellable; import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockRedstoneEvent; +import org.bukkit.event.entity.EntityInteractEvent; import org.bukkit.event.player.PlayerInteractEvent; // CraftBukkit end @@ -99,10 +101,16 @@ public class BlockPressurePlate extends Block { if (flag != flag1) { if (flag1) { for (Object object: list) { - if (object != null && object instanceof EntityHuman) { - PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, Action.PHYSICAL, i, j, k, -1, null); - - if (event.isCancelled()) { + if (object != null) { + Cancellable cancellable; + if (object instanceof EntityHuman) { + cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, Action.PHYSICAL, i, j, k, -1, null); + } + else if (object instanceof Entity) { + cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), ((WorldServer)world).getWorld().getBlockAt(i, j, k)); + } + else continue; + if (cancellable.isCancelled()) { return; } } |