Class NodeClickContext

java.lang.Object
io.github.somesourcecode.someguiapi.scene.context.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.
Since:
1.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    NodeClickContext(Scene scene, int x, int y, org.bukkit.event.inventory.ClickType type, org.bukkit.entity.HumanEntity whoClicked, 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.
    Returns the scene the click occurred in.
    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.
    org.bukkit.entity.HumanEntity
    Returns the human entity that clicked the node.
    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(Scene scene, int x, int y, org.bukkit.event.inventory.ClickType type, org.bukkit.entity.HumanEntity whoClicked, int hotBarButton)
      Creates a new node click context.
      Parameters:
      scene - the scene the click occurred in
      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
      whoClicked - the human entity that clicked the node
      hotBarButton - the hot bar button that was clicked
      Since:
      1.0.0
  • Method Details

    • getScene

      public Scene getScene()
      Returns the scene the click occurred in.
      Returns:
      the scene the click occurred in
      Since:
      1.0.0
    • 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
      Since:
      1.0.0
    • 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
      Since:
      1.0.0
    • getType

      public org.bukkit.event.inventory.ClickType getType()
      Returns the type of click that was performed.
      Returns:
      the type of click that was performed
      Since:
      1.0.0
    • 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
      Since:
      1.0.0
    • 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
      Since:
      1.0.0
    • 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
      Since:
      1.0.0
    • 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
      Since:
      1.0.0
    • getWhoClicked

      public org.bukkit.entity.HumanEntity getWhoClicked()
      Returns the human entity that clicked the node.
      Returns:
      the human entity that clicked the node
      Since:
      1.0.0
    • 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
      Since:
      1.0.0
    • isConsumed

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

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