Class InventoryPreClickEvent
java.lang.Object
net.minestom.server.event.Event
net.minestom.server.event.CancellableEvent
net.minestom.server.event.inventory.InventoryPreClickEvent
public class InventoryPreClickEvent extends CancellableEvent
Called before
InventoryClickEvent
, used to potentially cancel the click.-
Constructor Summary
-
Method Summary
Modifier and Type Method Description ItemStack
getClickedItem()
Gets the item who have been clicked.ClickType
getClickType()
Gets the click type.ItemStack
getCursorItem()
Gets the item who was in the player cursor.Inventory
getInventory()
Can be null if the clicked inventory is the player one.Player
getPlayer()
Gets the player who is trying to click on the inventory.int
getSlot()
Gets the clicked slot number.void
setClickedItem(ItemStack clickedItem)
Changes the clicked item.void
setCursorItem(ItemStack cursorItem)
Changes the cursor item.
-
Constructor Details
-
Method Details
-
getPlayer
Gets the player who is trying to click on the inventory.- Returns:
- the player who clicked
-
getInventory
Can be null if the clicked inventory is the player one.- Returns:
- the inventory where the click happened, null if this is the player's inventory
-
getSlot
public int getSlot()Gets the clicked slot number.- Returns:
- the clicked slot number
-
getClickType
Gets the click type.- Returns:
- the click type
-
getClickedItem
Gets the item who have been clicked.- Returns:
- the clicked item
-
setClickedItem
Changes the clicked item.- Parameters:
clickedItem
- the clicked item
-
getCursorItem
Gets the item who was in the player cursor.- Returns:
- the cursor item
-
setCursorItem
Changes the cursor item.- Parameters:
cursorItem
- the cursor item
-