summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockRedstoneWire.patch
blob: 0f200a35003332abd12f9e3d8d1fc36e4222b959 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- a/net/minecraft/server/BlockRedstoneWire.java
+++ b/net/minecraft/server/BlockRedstoneWire.java
@@ -9,6 +9,8 @@
 import java.util.Set;
 import javax.annotation.Nullable;
 
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
 public class BlockRedstoneWire extends Block {
 
     public static final BlockStateEnum<BlockRedstoneWire.EnumRedstoneWireConnection> NORTH = BlockStateEnum.of("north", BlockRedstoneWire.EnumRedstoneWireConnection.class);
@@ -168,6 +170,15 @@
             j = k;
         }
 
+        // CraftBukkit start
+        if (i != j) {
+            BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), i, j);
+            world.getServer().getPluginManager().callEvent(event);
+
+            j = event.getNewCurrent();
+        }
+        // CraftBukkit end
+
         if (i != j) {
             iblockdata = iblockdata.set(BlockRedstoneWire.POWER, Integer.valueOf(j));
             if (world.getType(blockposition) == iblockdata1) {