Class PlayerBundleItemSelectEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.inventory.InventoryEvent
io.papermc.paper.event.inventory.PlayerBundleItemSelectEvent
Called when a
Player selects an item inside a bundle.- API Note:
- This event does not fire for bundle item selections in creative mode player inventories.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents a selection direction.Nested classes/interfaces inherited from class Event
Event.Result -
Field Summary
Fields inherited from class InventoryEvent
transaction -
Constructor Summary
ConstructorsConstructorDescriptionPlayerBundleItemSelectEvent(InventoryView view, ItemStack bundle, int rawSlot, ItemStack previousItem, ItemStack selectedItem, int previousIndex, int selectedIndex, PlayerBundleItemSelectEvent.Direction direction) -
Method Summary
Modifier and TypeMethodDescriptionGets the bundle item.Gets the direction from the previous selection to the new one.static HandlerListGets the player who triggered the event.intGets the previously selected index.Gets the previously selected item inside the bundle.intGets the raw slot number of the bundle inside theInventoryView.intGets the selected index.Gets the selected item inside the bundle.intgetSlot()Gets the slot number of the bundle, depending on whichInventoryit is located in.Methods inherited from class InventoryEvent
getInventory, getView, getViewersMethods inherited from class Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerBundleItemSelectEvent
@Internal public PlayerBundleItemSelectEvent(InventoryView view, ItemStack bundle, int rawSlot, ItemStack previousItem, ItemStack selectedItem, int previousIndex, int selectedIndex, PlayerBundleItemSelectEvent.Direction direction)
-
-
Method Details
-
getPlayer
-
getBundle
-
getSlot
public int getSlot()Gets the slot number of the bundle, depending on whichInventoryit is located in.- Returns:
- the slot number
- See Also:
-
getRawSlot
public int getRawSlot()Gets the raw slot number of the bundle inside theInventoryView.- Returns:
- the raw slot number
- See Also:
-
getPreviousItem
Gets the previously selected item inside the bundle. If no item was previously selected, this will return an empty item.- Returns:
- the previously selected item
-
getSelectedItem
Gets the selected item inside the bundle.- Returns:
- the selected item
-
getPreviousIndex
public int getPreviousIndex()Gets the previously selected index. If no item was previously selected, this will be -1.- Returns:
- the previously selected index
-
getSelectedIndex
public int getSelectedIndex()Gets the selected index.- Returns:
- the selected index
-
getDirection
Gets the direction from the previous selection to the new one.- Returns:
- the direction
- API Note:
- The direction cannot be reliably determined if there are less than three item stacks inside the bundle, in which case this returns
PlayerBundleItemSelectEvent.Direction.UNKNOWN.
-
getHandlers
- Overrides:
getHandlersin classInventoryEvent
-
getHandlerList
-