Interface ChangeInventoryEvent.Pickup.Pre

All Superinterfaces:
Cancellable, Event
Enclosing interface:
ChangeInventoryEvent.Pickup

public static interface ChangeInventoryEvent.Pickup.Pre extends Event, Cancellable
Fires before an Item is picked up.

Modifying the picked up items causes this event to be automatically canceled if the inventory does not fit the entire list.

  • Method Details Link icon

    • inventory Link icon

      Inventory inventory()
      Gets the Inventory.
      Returns:
      The inventory.
    • item Link icon

      Item item()
      Gets the Item.
      Returns:
      The item
    • originalStack Link icon

      default ItemStackSnapshot originalStack()
      Returns the original picked up ItemStackSnapshot to add to the inventory.
      Returns:
      The original picked up item
    • custom Link icon

      Returns the custom set list of items to add to the inventory or Optional.empty() if not set.
      Returns:
      The custom set list
    • setCustom Link icon

      void setCustom(List<ItemStackSnapshot> items)
      Sets the items to add to the inventory.

      If all items do not fit the inventory this event will be automatically canceled.

      Parameters:
      items - The items to add to the inventory
    • finalStacks Link icon

      List<ItemStackSnapshot> finalStacks()
      Returns the proposed final list of items to add to the inventory.

      If a custom list was set all items have to fit the inventory or this event will be automatically canceled.

      Returns:
      The proposed final list