Package org.bukkit.event.block
Class BlockDropItemEvent
- java.lang.Object
-
- org.bukkit.event.Event
-
- org.bukkit.event.block.BlockEvent
-
- org.bukkit.event.block.BlockDropItemEvent
-
- All Implemented Interfaces:
Cancellable
public class BlockDropItemEvent extends BlockEvent implements Cancellable
Called if a block broken by a player drops an item. If the block break is cancelled, this event won't be called. If isDropItems in BlockBreakEvent is set to false, this event won't be called. 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 have an event call. The Block is already broken as this event is called, so #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 org.bukkit.event.Event
Event.Result
-
-
Field Summary
-
Fields inherited from class org.bukkit.event.block.BlockEvent
block
-
-
Constructor Summary
Constructors Constructor Description BlockDropItemEvent(@NotNull Block block, @NotNull BlockState blockState, @NotNull Player player, @NotNull List<Item> items)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull BlockState
getBlockState()
Gets the BlockState of the block involved in this event before it was broken.static @NotNull HandlerList
getHandlerList()
@NotNull HandlerList
getHandlers()
@NotNull List<Item>
getItems()
Gets list of the Item drops caused by the block break.@NotNull Player
getPlayer()
Gets the Player that is breaking 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.-
Methods inherited from class org.bukkit.event.block.BlockEvent
getBlock
-
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
-
-
-
Constructor Detail
-
BlockDropItemEvent
public BlockDropItemEvent(@NotNull @NotNull Block block, @NotNull @NotNull BlockState blockState, @NotNull @NotNull Player player, @NotNull @NotNull List<Item> items)
-
-
Method Detail
-
getPlayer
@NotNull public @NotNull Player getPlayer()
Gets the Player that is breaking the block involved in this event.- Returns:
- The Player that is breaking the block involved in this event
-
getBlockState
@NotNull public @NotNull BlockState 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
-
getItems
@NotNull public @NotNull List<Item> getItems()
Gets list of the Item drops caused by the block break. This list is mutable - removing an item from it will cause it to not drop. It is not legal however to add new items to the list.- Returns:
- The Item the block caused to drop
-
isCancelled
public boolean isCancelled()
Description copied from interface:Cancellable
Gets 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:
isCancelled
in interfaceCancellable
- Returns:
- true if this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel)
Description copied from interface:Cancellable
Sets 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:
setCancelled
in interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-
getHandlers
@NotNull public @NotNull HandlerList getHandlers()
- Specified by:
getHandlers
in classEvent
-
getHandlerList
@NotNull public static @NotNull HandlerList getHandlerList()
-
-