Commits
Nate Mortensen authored f94692bbe3d
1 + | package org.bukkit.event.block; |
2 + | |
3 + | import com.google.common.collect.ImmutableList; |
4 + | import org.bukkit.block.Block; |
5 + | import org.bukkit.block.BlockState; |
6 + | import org.bukkit.entity.Player; |
7 + | import org.bukkit.inventory.ItemStack; |
8 + | |
9 + | import java.util.List; |
10 + | |
11 + | /** |
12 + | * Fired when a single block placement action of a player triggers the |
13 + | * creation of multiple blocks(e.g. placing a bed block). The block returned |
14 + | * by {@link #getBlockPlaced()} and its related methods is the block where |
15 + | * the placed block would exist if the placement only affected a single |
16 + | * block. |
17 + | */ |
18 + | public class BlockMultiPlaceEvent extends BlockPlaceEvent { |
19 + | private final List<BlockState> states; |
20 + | |
21 + | public BlockMultiPlaceEvent(List<BlockState> states, Block clicked, ItemStack itemInHand, Player thePlayer, boolean canBuild) { |
22 + | super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild); |
23 + | this.states = ImmutableList.copyOf(states); |
24 + | } |
25 + | |
26 + | /** |
27 + | * Gets a list of blockstates for all blocks which were replaced by the |
28 + | * placement of the new blocks. Most of these blocks will just have a |
29 + | * Material type of AIR. |
30 + | * |
31 + | * @return immutable list of replaced BlockStates |
32 + | */ |
33 + | public List<BlockState> getReplacedBlockStates() { |
34 + | return states; |
35 + | } |
36 + | } |