Class NodeClickContext

java.lang.Object
io.github.somesourcecode.someguiapi.scene.action.NodeClickContext

public class NodeClickContext extends Object
Represents the context of a node click. It contains information about the type of click that was performed and the player that clicked.
  • Constructor Summary

    Constructors
    Constructor
    Description
    NodeClickContext(int x, int y, org.bukkit.event.inventory.ClickType type, org.bukkit.entity.Player player, int hotBarButton)
    Creates a new node click context.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Consumes the click.
    int
    Returns the hot bar button that was clicked.
    org.bukkit.entity.Player
    Returns the player that clicked the node.
    int
    Returns the x coordinate of the slot that was clicked.
    int
    Returns the y coordinate of the slot that was clicked.
    org.bukkit.event.inventory.ClickType
    Returns the type of click that was performed.
    boolean
    Returns true if the click has been consumed; false otherwise.
    boolean
    Return true if the click was a hot bar click; false otherwise.
    boolean
    Return true if the click was a left click; false otherwise.
    boolean
    Return true if the click was a right click; false otherwise.
    boolean
    Return true if the click was a shift click; false otherwise.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NodeClickContext

      public NodeClickContext(int x, int y, org.bukkit.event.inventory.ClickType type, org.bukkit.entity.Player player, int hotBarButton)
      Creates a new node click context.
      Parameters:
      x - the x coordinate of the slot that was clicked
      y - the y coordinate of the slot that was clicked
      type - the type of click that was performed
      player - the player that clicked the node
      hotBarButton - the hot bar button that was clicked
  • Method Details

    • getSlotX

      public int getSlotX()
      Returns the x coordinate of the slot that was clicked. This is the slot's x coordinate in the inventory, and not relative to the nodes bounds.
      Returns:
      the x coordinate of the slot that was clicked
    • getSlotY

      public int getSlotY()
      Returns the y coordinate of the slot that was clicked. This is the slot's y coordinate in the inventory, and not relative to the nodes bounds.
      Returns:
      the y coordinate of the slot that was clicked
    • getType

      public org.bukkit.event.inventory.ClickType getType()
      Returns the type of click that was performed.
      Returns:
      the type of click that was performed
    • isLeftClick

      public boolean isLeftClick()
      Return true if the click was a left click; false otherwise. This method is equivalent to calling getType().isLeftClick().
      Returns:
      whether the click was a left click
    • isRightClick

      public boolean isRightClick()
      Return true if the click was a right click; false otherwise. This method is equivalent to calling getType().isRightClick().
      Returns:
      whether the click was a right click
    • isShiftClick

      public boolean isShiftClick()
      Return true if the click was a shift click; false otherwise. This method is equivalent to calling getType().isShiftClick().
      Returns:
      whether the click was a shift click
    • isHotBarClick

      public boolean isHotBarClick()
      Return true if the click was a hot bar click; false otherwise.
      Returns:
      whether the click was a hot bar click
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Returns the player that clicked the node.
      Returns:
      the player that clicked the node
    • getHotBarButton

      public int getHotBarButton()
      Returns the hot bar button that was clicked. If the click was not a hot bar click, this method returns -1.
      Returns:
      the hot bar button that was clicked
    • isConsumed

      public boolean isConsumed()
      Returns true if the click has been consumed; false otherwise.
      Returns:
      whether the click has been consumed
    • consume

      public void consume()
      Consumes the click. Once a click has been consumed, isConsumed() will return true.