Validate tripwire hook placement before update

This commit is contained in:
Shane Freeder 2020-03-07 00:07:51 +00:00
parent 4bff4be120
commit 26067ca04b

View File

@ -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);