Interface HarvestEvent

All Superinterfaces:
Cancellable, Event, FarmingEvent

public interface HarvestEvent extends FarmingEvent, Cancellable
Fired when a block taking part in farming is about to drop what it gives: a player who is not in creative mode breaks it or picks its fruits, or it breaks on its own because it can no longer stand. FarmingEvent.block() is the state giving the harvest.

drops() can be modified: what is left in it once the event is over is dropped. Cancelling the event drops nothing; the block is broken or picked all the same.

Since:
0.1.0
See Also:
  • Method Details

    • player

      @Nullable Player player()
      Returns the player harvesting the block, null when it breaks on its own.
      Returns:
      the player harvesting the block, null when it breaks on its own
      Since:
      0.1.0
    • tool

      ItemStack tool()
      Returns what the block is harvested with, ItemStack.EMPTY for a bare hand or when the block breaks on its own.
      Returns:
      what the block is harvested with, ItemStack.EMPTY for a bare hand or when the block breaks on its own
      Since:
      0.1.0
    • drops

      List<ItemStack> drops()
      Returns the stacks about to be dropped, which listeners may add to, remove from or replace.
      Returns:
      the stacks about to be dropped, which listeners may add to, remove from or replace
      Since:
      0.1.0