Cancellable
BlockMultiPlaceEvent
public class BlockPlaceEvent extends BlockEvent implements Cancellable
If a Block Place event is cancelled, the block will not be placed.
Event.Result
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
canBuild |
|
protected boolean |
cancel |
|
protected EquipmentSlot |
hand |
|
protected ItemStack |
itemInHand |
|
protected Block |
placedAgainst |
|
protected Player |
player |
|
protected BlockState |
replacedBlockState |
block
Constructor | Description |
---|---|
BlockPlaceEvent(@NotNull Block placedBlock,
@NotNull BlockState replacedBlockState,
@NotNull Block placedAgainst,
@NotNull ItemStack itemInHand,
@NotNull Player thePlayer,
boolean canBuild) |
Deprecated.
|
BlockPlaceEvent(@NotNull Block placedBlock,
@NotNull BlockState replacedBlockState,
@NotNull Block placedAgainst,
@NotNull ItemStack itemInHand,
@NotNull Player thePlayer,
boolean canBuild,
@NotNull EquipmentSlot hand) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
canBuild() |
Gets the value whether the player would be allowed to build here.
|
@NotNull Block |
getBlockAgainst() |
Gets the block that this block was placed against
|
@NotNull Block |
getBlockPlaced() |
Clarity method for getting the placed block.
|
@NotNull BlockState |
getBlockReplacedState() |
Gets the BlockState for the block which was replaced.
|
@NotNull EquipmentSlot |
getHand() |
Gets the hand which placed the block
|
static @NotNull HandlerList |
getHandlerList() |
|
@NotNull HandlerList |
getHandlers() |
|
@NotNull ItemStack |
getItemInHand() |
Gets the item in the player's hand when they placed the block.
|
@NotNull Player |
getPlayer() |
Gets the player who placed the block involved in this event.
|
boolean |
isCancelled() |
Gets the cancellation state of this event.
|
void |
setBuild(boolean canBuild) |
Sets the canBuild state of this event.
|
void |
setCancelled(boolean cancel) |
Sets the cancellation state of this event.
|
getBlock
getEventName, isAsynchronous
protected boolean cancel
protected boolean canBuild
protected Block placedAgainst
protected BlockState replacedBlockState
protected ItemStack itemInHand
protected Player player
protected EquipmentSlot hand
@Deprecated public BlockPlaceEvent(@NotNull @NotNull Block placedBlock, @NotNull @NotNull BlockState replacedBlockState, @NotNull @NotNull Block placedAgainst, @NotNull @NotNull ItemStack itemInHand, @NotNull @NotNull Player thePlayer, boolean canBuild)
public BlockPlaceEvent(@NotNull @NotNull Block placedBlock, @NotNull @NotNull BlockState replacedBlockState, @NotNull @NotNull Block placedAgainst, @NotNull @NotNull ItemStack itemInHand, @NotNull @NotNull Player thePlayer, boolean canBuild, @NotNull @NotNull EquipmentSlot hand)
public boolean isCancelled()
Cancellable
isCancelled
in interface Cancellable
public void setCancelled(boolean cancel)
Cancellable
setCancelled
in interface Cancellable
cancel
- true if you wish to cancel this event@NotNull public @NotNull Player getPlayer()
@NotNull public @NotNull Block getBlockPlaced()
@NotNull public @NotNull BlockState getBlockReplacedState()
@NotNull public @NotNull Block getBlockAgainst()
@NotNull public @NotNull ItemStack getItemInHand()
@NotNull public @NotNull EquipmentSlot getHand()
public boolean canBuild()
public void setBuild(boolean canBuild)
canBuild
- true if you want the player to be able to build@NotNull public @NotNull HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
Copyright © 2020. All rights reserved.