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 and Description |
---|---|
protected boolean |
canBuild |
protected boolean |
cancel |
protected EquipmentSlot |
hand |
protected ItemStack |
itemInHand |
protected Block |
placedAgainst |
protected Player |
player |
protected BlockState |
replacedBlockState |
block
Constructor and 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 and 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.
|
getBlock
callEvent, 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(Block placedBlock, BlockState replacedBlockState, Block placedAgainst, ItemStack itemInHand, Player thePlayer, boolean canBuild)
public BlockPlaceEvent(Block placedBlock, BlockState replacedBlockState, Block placedAgainst, ItemStack itemInHand, Player thePlayer, boolean canBuild, 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 eventpublic Player getPlayer()
public Block getBlockPlaced()
public BlockState getBlockReplacedState()
public Block getBlockAgainst()
public ItemStack getItemInHand()
public EquipmentSlot getHand()
public boolean canBuild()
public void setBuild(boolean canBuild)
canBuild
- true if you want the player to be able to buildpublic HandlerList getHandlers()
getHandlers
in class Event
public static HandlerList getHandlerList()
Copyright © 2021. All rights reserved.