public final class MenuClick extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MenuClick.InventorySlot
An encapsulation of inventory slot interactions.
|
| Modifier and Type | Field and Description |
|---|---|
protected org.bukkit.entity.Player |
player
The player who clicked the Menu.
|
| Modifier | Constructor and Description |
|---|---|
protected |
MenuClick(org.bukkit.event.inventory.InventoryClickEvent e,
org.bukkit.entity.Player player)
Create a
MenuClick to pass to a MenuAction. |
| Modifier and Type | Method and Description |
|---|---|
void |
allowClick()
Uncancel the event and allow the click to follow through.
|
void |
disallowClick()
Cancel the click event, preventing pickup of the item.
|
org.bukkit.event.inventory.ClickType |
getClickType()
Get the
ClickType of this event. |
org.bukkit.inventory.InventoryView |
getInventoryView()
Get the full InventoryView of the transaction.
|
Optional<org.bukkit.inventory.ItemStack> |
getItemOnMouseCursor()
Check for the item currently on the cursor.
|
org.bukkit.entity.Player |
getPlayer()
Get the player that clicked the Menu.
|
Optional<MenuClick.InventorySlot> |
getSlotClicked()
Get an Optional describing the slot clicked, if applicable.
|
protected final org.bukkit.entity.Player player
protected MenuClick(org.bukkit.event.inventory.InventoryClickEvent e,
org.bukkit.entity.Player player)
MenuClick to pass to a MenuAction.e - original eventplayer - a playerpublic org.bukkit.entity.Player getPlayer()
public org.bukkit.inventory.InventoryView getInventoryView()
public org.bukkit.event.inventory.ClickType getClickType()
ClickType of this event.
Feel free to explore the enum, it looks powerful.
InventoryClickEvent.getClick()public Optional<MenuClick.InventorySlot> getSlotClicked()
public Optional<org.bukkit.inventory.ItemStack> getItemOnMouseCursor()
This is usually null, so instead of using the Nullable
annotation here I chose to use Optional.ofNullable(T).
public void allowClick()
public void disallowClick()
Copyright © 2021. All rights reserved.