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 Details

  • Method Details

    • getPlayer

      @NotNull public Player getPlayer()
      Gets the player who is trying to click on the inventory.
      Returns:
      the player who clicked
    • getInventory

      @Nullable public Inventory 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

      @NotNull public ClickType getClickType()
      Gets the click type.
      Returns:
      the click type
    • getClickedItem

      @NotNull public ItemStack getClickedItem()
      Gets the item who have been clicked.
      Returns:
      the clicked item
    • setClickedItem

      public void setClickedItem​(@NotNull ItemStack clickedItem)
      Changes the clicked item.
      Parameters:
      clickedItem - the clicked item
    • getCursorItem

      @NotNull public ItemStack getCursorItem()
      Gets the item who was in the player cursor.
      Returns:
      the cursor item
    • setCursorItem

      public void setCursorItem​(@NotNull ItemStack cursorItem)
      Changes the cursor item.
      Parameters:
      cursorItem - the cursor item