From f518ced9adc7f2423e8bef4f3f2956709b934044 Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Mon, 27 Jun 2011 23:10:32 -0400 Subject: [PATCH] Fixed BlockRedstone event firing too many times under certain circumstances. --- src/main/java/net/minecraft/server/BlockDoor.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java index 9cb066bb91..60973530a8 100644 --- a/src/main/java/net/minecraft/server/BlockDoor.java +++ b/src/main/java/net/minecraft/server/BlockDoor.java @@ -163,8 +163,6 @@ public class BlockDoor extends Block { this.g(world, i, j, k, i1); } } else if (l > 0 && Block.byId[l].isPowerSource()) { - boolean flag1 = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k); - // CraftBukkit start org.bukkit.World bworld = world.getWorld(); org.bukkit.block.Block block = bworld.getBlockAt(i, j, k); @@ -173,14 +171,15 @@ public class BlockDoor extends Block { int power = block.getBlockPower(); int powerTop = blockTop.getBlockPower(); if (powerTop > power) power = powerTop; + int oldPower = (world.getData(i, j, k) & 4) > 0 ? 15 : 0; - BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, (world.getData(i, j, k) & 4) > 0 ? 15 : 0, power); - world.getServer().getPluginManager().callEvent(eventRedstone); + if (oldPower == 0 ^ power == 0) { + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, oldPower, power); + world.getServer().getPluginManager().callEvent(eventRedstone); - flag1 = eventRedstone.getNewCurrent() > 0; + this.setDoor(world, i, j, k, eventRedstone.getNewCurrent() > 0); + } // CraftBukkit end - - this.setDoor(world, i, j, k, flag1); } } }