001 package org.bukkit.event.block; 002 003 import com.google.common.collect.ImmutableList; 004 import org.bukkit.block.Block; 005 import org.bukkit.block.BlockState; 006 import org.bukkit.entity.Player; 007 import org.bukkit.inventory.ItemStack; 008 009 import java.util.List; 010 011 /** 012 * Fired when a single block placement action of a player triggers the 013 * creation of multiple blocks(e.g. placing a bed block). The block returned 014 * by {@link #getBlockPlaced()} and its related methods is the block where 015 * the placed block would exist if the placement only affected a single 016 * block. 017 */ 018 public class BlockMultiPlaceEvent extends BlockPlaceEvent { 019 private final List<BlockState> states; 020 021 public BlockMultiPlaceEvent(List<BlockState> states, Block clicked, ItemStack itemInHand, Player thePlayer, boolean canBuild) { 022 super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild); 023 this.states = ImmutableList.copyOf(states); 024 } 025 026 /** 027 * Gets a list of blockstates for all blocks which were replaced by the 028 * placement of the new blocks. Most of these blocks will just have a 029 * Material type of AIR. 030 * 031 * @return immutable list of replaced BlockStates 032 */ 033 public List<BlockState> getReplacedBlockStates() { 034 return states; 035 } 036 }