diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-03-16 21:27:24 +0100 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-03-17 20:02:15 +0100 |
commit | f28f3a6a9cc3047c5c1aa2e7a0b456d1f4197f1b (patch) | |
tree | 596d38bf34f6ffa23008d9d3b3e26bf388d7f0e9 /src/main | |
parent | 2ae5b98d104663244caae49c3e485af5fdcd0624 (diff) | |
download | craftbukkit-f28f3a6a9cc3047c5c1aa2e7a0b456d1f4197f1b.tar craftbukkit-f28f3a6a9cc3047c5c1aa2e7a0b456d1f4197f1b.tar.gz craftbukkit-f28f3a6a9cc3047c5c1aa2e7a0b456d1f4197f1b.tar.lz craftbukkit-f28f3a6a9cc3047c5c1aa2e7a0b456d1f4197f1b.tar.xz craftbukkit-f28f3a6a9cc3047c5c1aa2e7a0b456d1f4197f1b.zip |
BlockInteract fixed for pressure plates
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockPressurePlate.java | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java index fc8a940f..de3a0f69 100644 --- a/src/main/java/net/minecraft/server/BlockPressurePlate.java +++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java @@ -68,24 +68,6 @@ public class BlockPressurePlate extends Block { public void a(World world, int i, int j, int k, Entity entity) { if (!world.isStatic) { if (world.getData(i, j, k) != 1) { - - // CraftBukkit start - Interact Pressure Plate - if (entity instanceof EntityLiving) { - CraftServer server = ((WorldServer) world).getServer(); - CraftWorld craftWorld = ((WorldServer) world).getWorld(); - Type eventType = Type.BLOCK_INTERACT; - CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); - org.bukkit.entity.LivingEntity who = (entity == null) ? null : (LivingEntity) entity.getBukkitEntity(); - - BlockInteractEvent event = new BlockInteractEvent(eventType, block, who); - server.getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - } - // CraftBukkit end - this.g(world, i, j, k); } } @@ -113,13 +95,32 @@ public class BlockPressurePlate extends Block { flag1 = true; } - // CraftBukkit start + // CraftBukkit start - Interact Pressure Plate + CraftServer server = ((WorldServer) world).getServer(); + CraftWorld craftWorld = ((WorldServer) world).getWorld(); + CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); + if (flag != flag1) { - CraftWorld craftWorld = ((WorldServer) world).getWorld(); - CraftServer server = ((WorldServer) world).getServer(); - CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); + if (flag1) { + for (Object object: list) { + if (object != null && object instanceof EntityLiving) { + EntityLiving entity = (EntityLiving) object; + Type eventType = Type.BLOCK_INTERACT; + org.bukkit.entity.LivingEntity who = (LivingEntity) entity.getBukkitEntity(); + + BlockInteractEvent event = new BlockInteractEvent(eventType, block, who); + server.getPluginManager().callEvent(event); + + if (event.isCancelled()) { + return; + } + } + } + } + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0); server.getPluginManager().callEvent(eventRedstone); + flag1 = eventRedstone.getNewCurrent() > 0; } // CraftBukkit end |