Cancellable
public class BlockBreakEvent extends BlockExpEvent implements Cancellable
If you wish to have the block drop experience, you must set the experience value above 0. By default, experience will be set in the event if:
Note: Plugins wanting to simulate a traditional block drop should set the block to air and utilize their own methods for determining what the default drop for the block being broken is and what to do about it, if anything.
If a Block Break event is cancelled, the block will not break and experience will not drop.
Event.Result
block
Constructor | Description |
---|---|
BlockBreakEvent(Block theBlock,
Player player) |
Modifier and Type | Method | Description |
---|---|---|
Player |
getPlayer() |
Gets the Player that is breaking the block involved in this event.
|
boolean |
isCancelled() |
Gets the cancellation state of this event.
|
boolean |
isDropItems() |
Gets whether or not the block will drop items.
|
void |
setCancelled(boolean cancel) |
Sets the cancellation state of this event.
|
void |
setDropItems(boolean dropItems) |
Sets whether or not the block will drop items as it normally would.
|
getBlock
getExpToDrop, getHandlerList, getHandlers, setExpToDrop
getEventName, isAsynchronous
@NotNull public Player getPlayer()
public void setDropItems(boolean dropItems)
dropItems
- Whether or not the block will drop itemspublic boolean isDropItems()
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 eventCopyright © 2019. All rights reserved.