Class BlockDropItemEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
org.bukkit.event.block.BlockDropItemEvent
- All Implemented Interfaces:
Cancellable
Called after a block is broken by a player and potential drops are computed, even if said blocks loot table
does not define any drops at the point the event is constructed.
If the block break is cancelled, this event won't be called.
If BlockBreakEvent.isDropItems() is set to false, this event won't be
called.
If a block is broken and BlockBreakEvent.isDropItems() is set to true,
this event will be called even if the block does not drop any items, for example
glass broken by hand. In this case, getItems() will be empty.
This event will also be called if the player breaks a multi block structure,
for example a torch on top of a stone. Both items will be included in the getItems() list.
The Block is already broken as this event is called, so BlockEvent.getBlock() will be
AIR in most cases. Use getBlockState() for more Information about the broken
block.
-
Nested Class Summary
Nested classes/interfaces inherited from class Event
Event.Result -
Field Summary
Fields inherited from class BlockEvent
block -
Constructor Summary
ConstructorsConstructorDescriptionBlockDropItemEvent(@NotNull Block block, @NotNull BlockState blockState, @NotNull Player player, @NotNull List<Item> items) -
Method Summary
Modifier and TypeMethodDescriptionGets the BlockState of the block involved in this event before it was broken.static @NotNull HandlerListgetItems()Gets list of the Item drops caused by the block break.Gets the Player that is breaking the block involved in this event.booleanGets the cancellation state of this event.voidsetCancelled(boolean cancel) Sets the cancellation state of this event.Methods inherited from class BlockEvent
getBlockMethods inherited from class Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
BlockDropItemEvent
-
-
Method Details
-
getBlockState
Gets the BlockState of the block involved in this event before it was broken.- Returns:
- The BlockState of the block involved in this event
-
getPlayer
-
getItems
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
isCancelledin interfaceCancellable- Returns:
trueif this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableSets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel-trueif you wish to cancel this event
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-