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(Block block, BlockState blockState, Player player, List<Item> items)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BlockState
getBlockState()
Gets the BlockState of the block involved in this event before it was broken.static HandlerList
getHandlerList()
HandlerList
getHandlers()
List<Item>
getItems()
Gets list of the Item drops caused by the block break.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 Block block, @NotNull BlockState blockState, @NotNull Player player, @NotNull List<Item> items)
-
-
Method Detail
-
getPlayer
@NotNull public 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 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 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 HandlerList getHandlers()
- Specified by:
getHandlers
in classEvent
-
getHandlerList
@NotNull public static HandlerList getHandlerList()
-
-