Cancellable
public class BlockDamageEvent extends BlockEvent implements Cancellable
If a Block Damage event is cancelled, the block will not be damaged.
Event.Result
block
Constructor | Description |
---|---|
BlockDamageEvent(@NotNull Player player,
@NotNull Block block,
@NotNull ItemStack itemInHand,
boolean instaBreak) |
Modifier and Type | Method | Description |
---|---|---|
static @NotNull HandlerList |
getHandlerList() |
|
@NotNull HandlerList |
getHandlers() |
|
boolean |
getInstaBreak() |
Gets if the block is set to instantly break when damaged by the player.
|
@NotNull ItemStack |
getItemInHand() |
Gets the ItemStack for the item currently in the player's hand.
|
@NotNull Player |
getPlayer() |
Gets the player damaging the block involved in this event.
|
boolean |
isCancelled() |
Gets the cancellation state of this event.
|
void |
setCancelled(boolean cancel) |
Sets the cancellation state of this event.
|
void |
setInstaBreak(boolean bool) |
Sets if the block should instantly break when damaged by the player.
|
getBlock
getEventName, isAsynchronous
@NotNull public @NotNull Player getPlayer()
public boolean getInstaBreak()
public void setInstaBreak(boolean bool)
bool
- true if you want the block to instantly break when damaged
by the player@NotNull public @NotNull ItemStack getItemInHand()
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 HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
Copyright © 2020. All rights reserved.