diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-03-29 22:47:38 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-03-29 22:48:49 -0500 |
commit | af7ea28bc76581243308997ad2df9b020cf1853d (patch) | |
tree | ecf9d1133e90c4087a7676f91dc5060aa444429e /src/main/java/net | |
parent | 82e05d435be4d9fa9d27f8dba9877030dd06a75b (diff) | |
download | craftbukkit-af7ea28bc76581243308997ad2df9b020cf1853d.tar craftbukkit-af7ea28bc76581243308997ad2df9b020cf1853d.tar.gz craftbukkit-af7ea28bc76581243308997ad2df9b020cf1853d.tar.lz craftbukkit-af7ea28bc76581243308997ad2df9b020cf1853d.tar.xz craftbukkit-af7ea28bc76581243308997ad2df9b020cf1853d.zip |
Only call event when turning pressure plate on. Fixes BUKKIT-3881
Diffstat (limited to 'src/main/java/net')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockPressurePlateBinary.java | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java index 3b9de8a7..428386c5 100644 --- a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java +++ b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java @@ -43,21 +43,23 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract { while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); - // CraftBukkit start - Fire interact event when turning on a pressure plate - org.bukkit.World bworld = world.getWorld(); - org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager(); - org.bukkit.event.Cancellable cancellable; - - if (entity instanceof EntityHuman) { - cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null); - } else { - cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(i, j, k)); - manager.callEvent((EntityInteractEvent) cancellable); - } - - // We only want to block turning the plate on if all events are cancelled - if (cancellable.isCancelled()) { - continue; + // CraftBukkit start - Call interact event when turning on a pressure plate + if (this.c(world.getData(i, j, k)) == 0) { + org.bukkit.World bworld = world.getWorld(); + org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager(); + org.bukkit.event.Cancellable cancellable; + + if (entity instanceof EntityHuman) { + cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null); + } else { + cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(i, j, k)); + manager.callEvent((EntityInteractEvent) cancellable); + } + + // We only want to block turning the plate on if all events are cancelled + if (cancellable.isCancelled()) { + continue; + } } // CraftBukkit end |