Class PlayerDropItemEvent

java.lang.Object
fr.fidorial.event.player.PlayerDropItemEvent
All Implemented Interfaces:
Cancellable, Event, PlayerEvent

public final class PlayerDropItemEvent extends Object implements PlayerEvent, Cancellable
Fired when a player presses the drop key with an item in hand.
Since:
0.1.0
  • Constructor Details

    • PlayerDropItemEvent

      public PlayerDropItemEvent(Player player, ItemStack item, boolean wholeStack)
      Creates an event.
      Parameters:
      player - the player
      item - what the selected hotbar slot holds, ItemStack.EMPTY when nothing
      wholeStack - whether the whole stack is dropped (Ctrl+Q) rather than one item
      Since:
      0.1.0
  • Method Details

    • player

      public Player player()
      Description copied from interface: PlayerEvent
      Returns the player involved in this event.
      Specified by:
      player in interface PlayerEvent
      Returns:
      the player involved in this event
    • item

      public ItemStack item()
      Returns what the selected hotbar slot holds, ItemStack.EMPTY when nothing.
      Returns:
      what the selected hotbar slot holds, ItemStack.EMPTY when nothing
      Since:
      0.1.0
    • wholeStack

      public boolean wholeStack()
      Returns whether the whole stack is dropped rather than one item.
      Returns:
      whether the whole stack is dropped rather than one item
      Since:
      0.1.0
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Returns true if the action this event describes will not happen.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if the action this event describes will not happen
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: Cancellable
      Prevents or re-allows the action this event describes.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancelled - true to prevent it