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 Detail

      • item

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

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

        java.util.Optional<java.util.List<ItemStackSnapshot>> custom()
        Returns the custom set list of items to add to the inventory or Optional.empty() if not set.
        Returns:
        The custom set list
      • setCustom

        void setCustom​(java.util.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

        java.util.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