summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockTripwireHook.patch
blob: 1f6d5ba66e69a58976ec87b7e1c9b6cc3b1730c8 (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
28
29
--- ../work/decompile-8eb82bde//net/minecraft/server/BlockTripwireHook.java	2014-11-28 17:43:42.973707438 +0000
+++ src/main/java/net/minecraft/server/BlockTripwireHook.java	2014-11-28 17:38:17.000000000 +0000
@@ -5,6 +5,8 @@
 import java.util.Iterator;
 import java.util.Random;
 
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
 public class BlockTripwireHook extends Block {
 
     public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirectionLimit.HORIZONTAL);
@@ -141,6 +143,17 @@
             this.a(world, blockposition1, flag5, flag6, flag2, flag3);
         }
 
+        // CraftBukkit start
+        org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+
+        BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
+        world.getServer().getPluginManager().callEvent(eventRedstone);
+
+        if (eventRedstone.getNewCurrent() > 0) {
+            return;
+        }
+        // CraftBukkit end
+
         this.a(world, blockposition, flag5, flag6, flag2, flag3);
         if (!flag) {
             world.setTypeAndData(blockposition, iblockdata3.set(BlockTripwireHook.FACING, enumdirection), 3);