summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockPressurePlateAbstract.patch
blob: 775f0989ad925c4ef26ba3eb755c1e89e75bcb5c (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
30
31
--- a/net/minecraft/server/BlockPressurePlateAbstract.java
+++ b/net/minecraft/server/BlockPressurePlateAbstract.java
@@ -3,6 +3,8 @@
 import java.util.Random;
 import javax.annotation.Nullable;
 
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
 public abstract class BlockPressurePlateAbstract extends Block {
 
     protected static final AxisAlignedBB a = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.03125D, 0.9375D);
@@ -95,6 +97,19 @@
         boolean flag = i > 0;
         boolean flag1 = j > 0;
 
+        // CraftBukkit start - Interact Pressure Plate
+        org.bukkit.World bworld = world.getWorld();
+        org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
+
+        if (flag != flag1) {
+            BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), i, j);
+            manager.callEvent(eventRedstone);
+
+            flag1 = eventRedstone.getNewCurrent() > 0;
+            j = eventRedstone.getNewCurrent();
+        }
+        // CraftBukkit end
+
         if (i != j) {
             iblockdata = this.a(iblockdata, j);
             world.setTypeAndData(blockposition, iblockdata, 2);