PaperMC/nms-patches/BlockPressurePlateAbstract.patch

32 lines
1.3 KiB
Diff
Raw Normal View History

2015-02-26 23:41:06 +01:00
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPressurePlateAbstract.java 2015-02-26 22:40:22.211608143 +0000
+++ src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java 2015-02-26 22:40:22.215608143 +0000
@@ -2,6 +2,8 @@
import java.util.Random;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public abstract class BlockPressurePlateAbstract extends Block {
protected BlockPressurePlateAbstract(Material material) {
2015-02-26 23:41:06 +01:00
@@ -99,6 +101,19 @@
boolean flag = i > 0;
boolean flag1 = j > 0;
2015-02-26 23:41:06 +01:00
+ // 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
2015-02-26 23:41:06 +01:00
+
if (i != j) {
iblockdata = this.a(iblockdata, j);
2015-02-26 23:41:06 +01:00
world.setTypeAndData(blockposition, iblockdata, 2);