Class PageClick
- java.lang.Object
-
- com.mrivanplays.pagedinventory.api.PageClick
-
public final class PageClick extends Object
Represents a object, created whenInventoryClickEvent
was fired. You can make use of click events in paged inventories by usingPagedInventory.addOnClickFunction(java.util.function.Consumer)
-
-
Constructor Summary
Constructors Constructor Description PageClick(PagedInventory pagedInventory, Page page, org.bukkit.inventory.ItemStack clickedItem, org.bukkit.entity.Player clicker, org.bukkit.event.inventory.ClickType clickType, int slot, int rawSlot, int hotbarButton)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable org.bukkit.inventory.ItemStack
getClickedItem()
Returns the clickedItemStack
@NotNull org.bukkit.entity.Player
getClicker()
Returns thePlayer
, whom have clicked on the item.@NotNull org.bukkit.event.inventory.ClickType
getClickType()
Returns thegetClickedItem()
's triggered click type.int
getHotbarButton()
Took fromInventoryClickEvent
: If the ClickType is NUMBER_KEY, this method will return the index of the pressed key (0-8).@NotNull Page
getPage()
Returns the clickedPage
@NotNull PagedInventory
getPagedInventory()
Returns thePagedInventory
instance from which the click came.int
getRawSlot()
Took fromInventoryClickEvent
: The raw slot number clicked, ready for passing to#getItem(int)
This slot number is unique for the view.int
getSlot()
Took fromInventoryClickEvent
: The slot number that was clicked, ready for passing toInventory.getItem(int)
.
-
-
-
Constructor Detail
-
PageClick
public PageClick(PagedInventory pagedInventory, Page page, org.bukkit.inventory.ItemStack clickedItem, org.bukkit.entity.Player clicker, org.bukkit.event.inventory.ClickType clickType, int slot, int rawSlot, int hotbarButton)
-
-
Method Detail
-
getPagedInventory
@NotNull public @NotNull PagedInventory getPagedInventory()
Returns thePagedInventory
instance from which the click came.- Returns:
- paged inventory
-
getClickedItem
@Nullable public @Nullable org.bukkit.inventory.ItemStack getClickedItem()
Returns the clickedItemStack
- Returns:
- item
-
getClicker
@NotNull public @NotNull org.bukkit.entity.Player getClicker()
Returns thePlayer
, whom have clicked on the item.- Returns:
- player, clicker
-
getClickType
@NotNull public @NotNull org.bukkit.event.inventory.ClickType getClickType()
Returns thegetClickedItem()
's triggered click type.- Returns:
- click type
-
getSlot
public int getSlot()
Took fromInventoryClickEvent
: The slot number that was clicked, ready for passing toInventory.getItem(int)
. Note that there may be two slots with the same slot number, since a view links two different inventories.- Returns:
- The slot number.
-
getRawSlot
public int getRawSlot()
Took fromInventoryClickEvent
: The raw slot number clicked, ready for passing to#getItem(int)
This slot number is unique for the view.- Returns:
- the slot number
-
getHotbarButton
public int getHotbarButton()
Took fromInventoryClickEvent
: If the ClickType is NUMBER_KEY, this method will return the index of the pressed key (0-8).- Returns:
- the number on the key minus 1 (range 0-8); or -1 if not a NUMBER_KEY action
-
-