Interface ChangeInventoryEvent.Pickup.Pre
- All Superinterfaces:
Cancellable
,Event
- Enclosing interface:
- ChangeInventoryEvent.Pickup
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 Summary
Modifier and TypeMethodDescriptioncustom()
Returns the custom set list of items to add to the inventory orOptional.empty()
if not set.Returns the proposed final list of items to add to the inventory.Gets theInventory
.item()
Gets theItem
.default ItemStackSnapshot
Returns the original picked upItemStackSnapshot
to add to the inventory.void
setCustom
(List<ItemStackSnapshot> items) Sets the items to add to the inventory.Methods inherited from interface org.spongepowered.api.event.Cancellable
isCancelled, setCancelled
-
Method Details
-
inventory
Inventory inventory()Gets theInventory
.- Returns:
- The inventory.
-
item
Item item()Gets theItem
.- Returns:
- The item
-
originalStack
Returns the original picked upItemStackSnapshot
to add to the inventory.- Returns:
- The original picked up item
-
custom
Optional<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
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
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
-