Interface ChangeInventoryEvent.Pickup.Pre
-
- All Superinterfaces:
Cancellable
,Event
- Enclosing interface:
- ChangeInventoryEvent.Pickup
public static interface ChangeInventoryEvent.Pickup.Pre extends Event, Cancellable
Fires before anItem
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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.Optional<java.util.List<ItemStackSnapshot>>
custom()
Returns the custom set list of items to add to the inventory orOptional.empty()
if not set.java.util.List<ItemStackSnapshot>
finalStacks()
Returns the proposed final list of items to add to the inventory.Inventory
inventory()
Gets theInventory
.Item
item()
Gets theItem
.default ItemStackSnapshot
originalStack()
Returns the original picked upItemStackSnapshot
to add to the inventory.void
setCustom(java.util.List<ItemStackSnapshot> items)
Sets the items to add to the inventory.-
Methods inherited from interface org.spongepowered.api.event.Cancellable
isCancelled, setCancelled
-
-
-
-
Method Detail
-
originalStack
default ItemStackSnapshot originalStack()
Returns the original picked upItemStackSnapshot
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 orOptional.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
-
-