All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.event.block.BlockMultiPlaceEvent Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package org.bukkit.event.block;

import com.google.common.collect.ImmutableList;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.util.List;

/**
 * Fired when a single block placement action of a player triggers the
 * creation of multiple blocks(e.g. placing a bed block). The block returned
 * by {@link #getBlockPlaced()} and its related methods is the block where
 * the placed block would exist if the placement only affected a single
 * block.
 */
public class BlockMultiPlaceEvent extends BlockPlaceEvent {
  private final List states;

  public BlockMultiPlaceEvent(List states, Block clicked, ItemStack itemInHand, Player thePlayer, boolean canBuild) {
    super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild);
    this.states = ImmutableList.copyOf(states);
  }

  /**
   * Gets a list of blockstates for all blocks which were replaced by the
   * placement of the new blocks. Most of these blocks will just have a
   * Material type of AIR.
   *
   * @return immutable list of replaced BlockStates
   */
  public List getReplacedBlockStates() {
    return states;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy