Class PlayerUIElementClickEvent

java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.player.PlayerEvent
net.risingworld.api.events.player.ui.PlayerUIElementClickEvent

public final class PlayerUIElementClickEvent extends PlayerEvent
Called when a player clicks on a UI element. This does only work if UIElement.setClickable(boolean) was set to true.
  • Method Details

    • getUIElement

      public UIElement getUIElement()
      Gets the UI element that was clicked.
      Returns:
      the clicked UI element.
    • isDoubleClick

      public boolean isDoubleClick()
      Gets whether or not the player double-clicked the ui element.
      Returns:
      true if the player double-clicked on the ui element, false if it was just a single click.
    • getMouseButton

      public int getMouseButton()
      Gets the mouse button. Typically 0 for the left mouse button, 1 for the right mouse button and 2 for the middle button (pressing the mouse wheel).
      Returns:
      the mouse button.
    • getAbsoluteMousePositionX

      public float getAbsoluteMousePositionX()
      Gets the absolute x (horizontal) position of the mouse cursor (within the UI element).
      Returns:
      the absolute x mouse position.
    • getAbsoluteMousePositionY

      public float getAbsoluteMousePositionY()
      Gets the absolute y (vertical) position of the mouse cursor (within the UI element).
      Returns:
      the absolute y mouse position.
    • getRelativeMousePositionX

      public float getRelativeMousePositionX()
      Gets the relative (0-100 percent) x (horizontal) position of the mouse cursor (within the UI element).
      Returns:
      the relative x mouse position.
    • getRelativeMousePositionY

      public float getRelativeMousePositionY()
      Gets the relative (0-100 percent) y (vertical) position of the mouse cursor (within the UI element).
      Returns:
      the relative y mouse position.