Commits

Thinkofname authored cd94e3c9b03
Give BlockPistonRetractEvent a list of pulled blocks for sticky pistons
No tags

src/main/java/org/bukkit/event/block/BlockPistonRetractEvent.java

Modified
1 1 package org.bukkit.event.block;
2 2
3 +import java.util.List;
3 4 import org.bukkit.Location;
4 5 import org.bukkit.block.Block;
5 6 import org.bukkit.block.BlockFace;
6 7 import org.bukkit.event.HandlerList;
7 8
8 9 /**
9 10 * Called when a piston retracts
10 11 */
11 12 public class BlockPistonRetractEvent extends BlockPistonEvent {
12 13 private static final HandlerList handlers = new HandlerList();
13 - public BlockPistonRetractEvent(final Block block, final BlockFace direction) {
14 + private List<Block> blocks;
15 +
16 + public BlockPistonRetractEvent(final Block block, final List<Block> blocks, final BlockFace direction) {
14 17 super(block, direction);
15 18 }
16 19
17 20 /**
18 21 * Gets the location where the possible moving block might be if the
19 22 * retracting piston is sticky.
20 23 *
21 24 * @return The possible location of the possibly moving block.
22 25 */
26 + @Deprecated
23 27 public Location getRetractLocation() {
24 28 return getBlock().getRelative(getDirection(), 2).getLocation();
25 29 }
30 +
31 + /**
32 + * Get an immutable list of the blocks which will be moved by the
33 + * extending.
34 + *
35 + * @return Immutable list of the moved blocks.
36 + */
37 + public List<Block> getBlocks() {
38 + return blocks;
39 + }
26 40
27 41 @Override
28 42 public HandlerList getHandlers() {
29 43 return handlers;
30 44 }
31 45
32 46 public static HandlerList getHandlerList() {
33 47 return handlers;
34 48 }
35 49 }

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

Add shortcut