Paper/nms-patches/BlockTripwireHook.patch

30 lines
1.1 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockTripwireHook.java
+++ b/net/minecraft/server/BlockTripwireHook.java
2018-07-15 02:00:00 +02:00
@@ -4,6 +4,8 @@
import java.util.Random;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockTripwireHook extends Block {
2016-02-29 22:32:46 +01:00
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
2018-12-06 00:00:00 +01:00
@@ -134,6 +136,17 @@
2016-02-29 22:32:46 +01:00
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
+
2016-02-29 22:32:46 +01:00
this.a(world, blockposition, flag4, flag5, flag2, flag3);
if (!flag) {
2018-07-15 02:00:00 +02:00
world.setTypeAndData(blockposition, (IBlockData) iblockdata3.set(BlockTripwireHook.FACING, enumdirection), 3);