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 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) |
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.
|
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
getEventName, isAsynchronous
protected boolean cancel
protected boolean canBuild
protected Block placedAgainst
protected BlockState replacedBlockState
protected ItemStack itemInHand
protected Player player
public BlockPlaceEvent(Block placedBlock, BlockState replacedBlockState, Block placedAgainst, ItemStack itemInHand, Player thePlayer, boolean canBuild)
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 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 © 2022. All rights reserved.