Package org.bukkit.event.player
Class PlayerHarvestBlockEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
org.bukkit.event.player.PlayerHarvestBlockEvent
- All Implemented Interfaces:
- Cancellable
This event is called whenever a player harvests a block.
 
A 'harvest' is when a block drops an item (usually some sort of crop) and changes state, but is not broken in order to drop the item.
This event is not called for when a block is broken, to handle that, listen for
A 'harvest' is when a block drops an item (usually some sort of crop) and changes state, but is not broken in order to drop the item.
This event is not called for when a block is broken, to handle that, listen for
BlockBreakEvent and
 BlockDropItemEvent.- 
Nested Class SummaryNested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Field SummaryFields inherited from class org.bukkit.event.player.PlayerEventplayer
- 
Constructor SummaryConstructorsConstructorDescriptionPlayerHarvestBlockEvent(Player player, Block harvestedBlock, List<ItemStack> itemsHarvested) Deprecated.PlayerHarvestBlockEvent(Player player, Block harvestedBlock, EquipmentSlot hand, List<ItemStack> itemsHarvested) 
- 
Method SummaryModifier and TypeMethodDescriptiongetHand()Get the hand used to harvest the block.static HandlerListGets the block that is being harvested.Gets a list of items that are being harvested from this block.booleanGets the cancellation state of this event.voidsetCancelled(boolean cancel) Sets the cancellation state of this event.Methods inherited from class org.bukkit.event.player.PlayerEventgetPlayerMethods inherited from class org.bukkit.event.EventgetEventName, isAsynchronous
- 
Constructor Details- 
PlayerHarvestBlockEventpublic PlayerHarvestBlockEvent(@NotNull Player player, @NotNull Block harvestedBlock, @NotNull EquipmentSlot hand, @NotNull List<ItemStack> itemsHarvested) 
- 
PlayerHarvestBlockEvent@Deprecated(since="1.19.2") public PlayerHarvestBlockEvent(@NotNull Player player, @NotNull Block harvestedBlock, @NotNull List<ItemStack> itemsHarvested) Deprecated.
 
- 
- 
Method Details- 
getHarvestedBlockGets the block that is being harvested.- Returns:
- The block that is being harvested
 
- 
getHandGet the hand used to harvest the block.- Returns:
- the hand
 
- 
getItemsHarvestedGets a list of items that are being harvested from this block.- Returns:
- A list of items that are being harvested from this block
 
- 
isCancelledpublic 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 interface- Cancellable
- Returns:
- true if this event is cancelled
 
- 
setCancelledpublic 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 interface- Cancellable
- Parameters:
- cancel- true if you wish to cancel this event
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
 
-