Paper/nms-patches/BlockTripwireHook.patch
2016-05-10 21:47:39 +10:00

30 lines
1.1 KiB
Diff

--- a/net/minecraft/server/BlockTripwireHook.java
+++ b/net/minecraft/server/BlockTripwireHook.java
@@ -5,6 +5,8 @@
import java.util.Random;
import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockTripwireHook extends Block {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
@@ -155,6 +157,17 @@
this.a(world, blockposition1, flag4, flag5, 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, flag4, flag5, flag2, flag3);
if (!flag) {
world.setTypeAndData(blockposition, iblockdata3.set(BlockTripwireHook.FACING, enumdirection), 3);