Commits

md_5 authored fa6e97a8f8c
SPIGOT-4064: Fix BlockPistonRetractEvent for regular pistons
No tags

nms-patches/BlockPiston.patch

Modified
12 12 +
13 13 +import com.google.common.collect.ImmutableList;
14 14 +import org.bukkit.craftbukkit.block.CraftBlock;
15 15 +import org.bukkit.event.block.BlockPistonRetractEvent;
16 16 +import org.bukkit.event.block.BlockPistonExtendEvent;
17 17 +// CraftBukkit end
18 18 +
19 19 public class BlockPiston extends BlockDirectional {
20 20
21 21 public static final BlockStateBoolean EXTENDED = BlockProperties.f;
22 -@@ -109,6 +121,18 @@
23 - b0 = 2;
24 - }
22 +@@ -111,6 +123,18 @@
25 23 }
26 -+ // CraftBukkit start
27 -+ if (!this.sticky) {
28 -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
29 -+ BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.<org.bukkit.block.Block>of(), CraftBlock.notchToBlockFace(enumdirection));
30 -+ world.getServer().getPluginManager().callEvent(event);
31 -+
32 -+ if (event.isCancelled()) {
33 -+ return;
34 -+ }
35 -+ }
36 -+ // PAIL: checkME - what happened to setTypeAndData?
37 -+ // CraftBukkit end
38 24 }
39 25
26 ++ // CraftBukkit start
27 ++ if (!this.sticky) {
28 ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
29 ++ BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.<org.bukkit.block.Block>of(), CraftBlock.notchToBlockFace(enumdirection));
30 ++ world.getServer().getPluginManager().callEvent(event);
31 ++
32 ++ if (event.isCancelled()) {
33 ++ return;
34 ++ }
35 ++ }
36 ++ // PAIL: checkME - what happened to setTypeAndData?
37 ++ // CraftBukkit end
40 38 world.playBlockAction(blockposition, this, b0, enumdirection.a());
39 + }
40 +
41 41 @@ -271,6 +295,48 @@
42 42 IBlockData[] aiblockdata = new IBlockData[j];
43 43 EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();
44 44 HashSet hashset = Sets.newHashSet(list);
45 45 + // CraftBukkit start
46 46 + final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
47 47 +
48 48 + final List<BlockPosition> moved = pistonextendschecker.getMovedBlocks();
49 49 + final List<BlockPosition> broken = pistonextendschecker.getBrokenBlocks();
50 50 +

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut