Class NodeClickContext
java.lang.Object
io.github.somesourcecode.someguiapi.scene.context.NodeClickContext
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
ConstructorsConstructorDescriptionNodeClickContext(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 TypeMethodDescriptionvoidconsume()Consumes the click.intReturns the hot bar button that was clicked.getScene()Returns the scene the click occurred in.intgetSlotX()Returns the x coordinate of the slot that was clicked.intgetSlotY()Returns the y coordinate of the slot that was clicked.org.bukkit.event.inventory.ClickTypegetType()Returns the type of click that was performed.org.bukkit.entity.HumanEntityReturns the human entity that clicked the node.booleanReturns true if the click has been consumed; false otherwise.booleanReturn true if the click was a hot bar click; false otherwise.booleanReturn true if the click was a left click; false otherwise.booleanReturn true if the click was a right click; false otherwise.booleanReturn true if the click was a shift click; false otherwise.
-
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 inx- the x coordinate of the slot that was clickedy- the y coordinate of the slot that was clickedtype- the type of click that was performedwhoClicked- the human entity that clicked the nodehotBarButton- the hot bar button that was clicked- Since:
- 1.0.0
-
-
Method Details
-
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 callinggetType().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 callinggetType().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 callinggetType().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 returntrue.- Since:
- 1.0.0
-