From 26067ca04b349cbcbabc5fec0f92db18958a6bdd Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sat, 7 Mar 2020 00:07:51 +0000 Subject: [PATCH] Validate tripwire hook placement before update --- .../level/block/TripWireHookBlock.java.patch | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/TripWireHookBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/TripWireHookBlock.java.patch index ef0878b2e2..85f745ec8f 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/TripWireHookBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/TripWireHookBlock.java.patch @@ -11,19 +11,24 @@ public class TripWireHookBlock extends Block { -@@ -176,6 +180,15 @@ +@@ -174,10 +178,20 @@ + world.setBlock(blockposition1, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection1), 3); + TripWireHookBlock.notifyNeighbors(block, world, blockposition1, enumdirection1); TripWireHookBlock.emitState(world, blockposition1, flag4, flag5, flag2, flag3); - } - ++ } ++ + // CraftBukkit start + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(CraftBlock.at(world, pos), 15, 0); + world.getCraftServer().getPluginManager().callEvent(eventRedstone); + + if (eventRedstone.getNewCurrent() > 0) { + return; -+ } + } + // CraftBukkit end -+ + TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3); if (!flag) { ++ if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - Validate tripwire hook placement before update world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3); + if (flag1) { + TripWireHookBlock.notifyNeighbors(block, world, pos, enumdirection);