CancellableBlockMultiPlaceEventpublic 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(Block placedBlock,
BlockState replacedBlockState,
Block placedAgainst,
ItemStack itemInHand,
Player thePlayer,
boolean canBuild) |
Deprecated.
|
BlockPlaceEvent(Block placedBlock,
BlockState replacedBlockState,
Block placedAgainst,
ItemStack itemInHand,
Player thePlayer,
boolean canBuild,
EquipmentSlot hand) |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
canBuild() |
Gets the value whether the player would be allowed to build here.
|
Block |
getBlockAgainst() |
Gets the block that this block was placed against
|
Block |
getBlockPlaced() |
Clarity method for getting the placed block.
|
BlockState |
getBlockReplacedState() |
Gets the BlockState for the block which was replaced.
|
EquipmentSlot |
getHand() |
Gets the hand which placed the block
|
static HandlerList |
getHandlerList() |
|
HandlerList |
getHandlers() |
|
ItemStack |
getItemInHand() |
Gets the item in the player's hand when they placed the block.
|
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.
|
getBlockgetEventName, isAsynchronousprotected boolean cancel
protected boolean canBuild
protected Block placedAgainst
protected BlockState replacedBlockState
protected ItemStack itemInHand
protected Player player
protected EquipmentSlot hand
@Deprecated public BlockPlaceEvent(@NotNull Block placedBlock, @NotNull BlockState replacedBlockState, @NotNull Block placedAgainst, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild)
public BlockPlaceEvent(@NotNull
Block placedBlock,
@NotNull
BlockState replacedBlockState,
@NotNull
Block placedAgainst,
@NotNull
ItemStack itemInHand,
@NotNull
Player thePlayer,
boolean canBuild,
@NotNull
EquipmentSlot hand)
public boolean isCancelled()
CancellableisCancelled in interface Cancellablepublic void setCancelled(boolean cancel)
CancellablesetCancelled in interface Cancellablecancel - true if you wish to cancel this event@NotNull public Player getPlayer()
@NotNull public Block getBlockPlaced()
@NotNull public BlockState getBlockReplacedState()
@NotNull public Block getBlockAgainst()
@NotNull public ItemStack getItemInHand()
@NotNull public EquipmentSlot getHand()
public boolean canBuild()
public void setBuild(boolean canBuild)
canBuild - true if you want the player to be able to build@NotNull public HandlerList getHandlers()
getHandlers in class Event@NotNull public static HandlerList getHandlerList()
Copyright © 2020. All rights reserved.