Commits
md_5 authored 72f36890922
1 1 | --- a/net/minecraft/server/BlockRedstoneWire.java |
2 2 | +++ b/net/minecraft/server/BlockRedstoneWire.java |
3 3 | |
4 4 | import java.util.Set; |
5 5 | import javax.annotation.Nullable; |
6 6 | |
7 7 | +import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit |
8 8 | + |
9 9 | public class BlockRedstoneWire extends Block { |
10 10 | |
11 11 | public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.X; |
12 - | |
12 + | |
13 13 | private void a(World world, BlockPosition blockposition, IBlockData iblockdata) { |
14 14 | int i = this.a(world, blockposition); |
15 15 | |
16 16 | - if ((Integer) iblockdata.get(BlockRedstoneWire.POWER) != i) { |
17 17 | + // CraftBukkit start |
18 18 | + int oldPower = (Integer) iblockdata.get(BlockRedstoneWire.POWER); |
19 19 | + if (oldPower != i) { |
20 20 | + BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), oldPower, i); |
21 21 | + world.getServer().getPluginManager().callEvent(event); |
22 22 | + |
23 23 | + i = event.getNewCurrent(); |
24 + | + } |
25 + | + if (oldPower != i) { |
24 26 | + // CraftBukkit end |
25 27 | if (world.getType(blockposition) == iblockdata) { |
26 28 | world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneWire.POWER, i), 2); |
27 29 | } |