Class Mouse


  • public class Mouse
    extends java.lang.Object

    Please note: In general you do not have to concern yourself with these methods.
    The methods here will be called from interact methods by the API (such as the interact method in RectangleDestination)

    • Constructor Summary

      Constructors 
      Constructor Description
      Mouse()
      Deprecated.
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static boolean click()
      Triggers a left click
      static boolean click​(boolean right)
      Triggers a left click
      static boolean click​(java.awt.Point destination)
      Moves mouse to point, and preforms left click.
      static boolean click​(java.awt.Point destination, boolean right)
      Moves mouse to point, and preforms desired type of click, as determines by arguments.
      static boolean click​(java.awt.Rectangle destination)
      Moves mouse to rectangle, and preforms left click.
      static boolean click​(java.awt.Rectangle destination, boolean right)
      Moves mouse to rectangle, and preforms desired type of click, as determines by arguments.
      static boolean click​(ClickMode mode)
      Triggers a click as determined by the ClickMode
      static boolean click​(AbstractMouseDestination destination)
      Moves mouse to destination, and preforms left click.
      static boolean click​(AbstractMouseDestination destination, boolean right)
      Moves mouse to destination, and preforms desired type of click, as determines by arguments.
      static boolean click​(AbstractMouseDestination destination, ClickMode type)
      Triggers a click based from ClickMode, and at desired destination.
      static boolean click​(Entity destination)
      Moves mouse to entity, and preforms left click.
      static boolean click​(Entity destination, boolean right)
      Moves mouse to entity, and preforms desired type of click, as determines by arguments.
      static boolean drag​(java.awt.Point point)
      Drags the mouse from current point to the given point
      static boolean drag​(java.awt.Rectangle rectangle)
      Drags the mouse from current position to the given Rectangle
      static boolean drag​(AbstractMouseDestination destination)
      Drags the mouse to the given AbstractMouseDestination
      static boolean drag​(Tile tile)
      Drags the mouse from the current point to the given Tile
      static boolean drag​(Entity entity)
      Drags the mouse from the current position to the given Entity
      static Mouse getContext()
      Deprecated. 
      static int getCrosshairColorID()
      Gets the current crosshair color of the mouse.
      static CrosshairState getCrosshairState()
      Gets the current crosshair color of the mouse.
      static java.util.List<Entity> getEntitiesOnCursor()
      Gets a list of the entities that the cursor is hovering over
      static int getIdleTime()
      Gets idle time.
      static java.awt.Point getLastClicked()
      Gets last clicked position by the client
      static int getLastClickedX()
      Gets last clicked x position by the client
      static int getLastClickedY()
      Gets last clicked y position by the client
      static int getLastCrosshairColorID()
      Gets the crosshair color from the last click.
      static double getLastMouseDirection()  
      static double getLastMouseMagnitude()  
      static long getLastMouseMoveTime()  
      static Mouse getMouse()
      Deprecated.
      static long getMouseMoveResetTimeMillis()  
      static MouseSettings getMouseSettings()
      Grabs the MouseSettings
      static long[] getOnCursorUIDs()  
      static java.awt.Point getPointOutsideScreen()  
      static java.awt.Point getPosition()
      Gets the current mouse position on the game canvas if the canvas contains the mouse.
      static long[] getRawOnCursorUIDs()  
      static int getRSLastClickedX()  
      static int getRSLastClickedY()  
      static int getUIDCount()  
      static int getX()
      Gets the current mouse X coordinate of the mouse if inside the canvas.
      static int getY()
      Gets the current mouse Y coordinate of the mouse if inside the canvas.
      static boolean hop​(int x, int y)
      Method to 'hop' the mouse position, instantly.
      static boolean hop​(java.awt.Point destination)
      Method to 'hop' the mouse position, instantly.
      static boolean isAlwaysHop()  
      static boolean isMouseInScreen()
      Method to determine if the mouse cursor is in the screen.
      static void mouseDownWhile​(int timeout, Condition c)
      Hold mouse down until condition is true, with specified timeout
      static boolean move()
      Moves the mouse to random gaussian distributed destination near the location of your current position if the mouse is on screen, otherwise will base position from center of canvas.
      static boolean move​(java.awt.Point point)
      Moves the mouse to a specified point
      static boolean move​(java.awt.Rectangle rectangle)
      Moves the mouse to a specified rectangle
      static boolean move​(AbstractMouseDestination destination)
      Moves the mouse to a destination
      static boolean move​(Tile tile)  
      static boolean move​(Entity entity)
      Moves the mouse to a destination
      static boolean moveMouseOutsideScreen()
      Moves the mouse outside of the screen
      static void scrollDownUntil​(int timeout, Condition c)
      Scrolls mouse wheel down until Condition is true or timeout is met
      static void scrollDownWhile​(int timeout, Condition c)
      Deprecated.
      This method is to be replaced with scrollDownUntil instead, since it was incorrectly implemented to act the same anyways
      static void scrollUntil​(boolean up, int timeout, Condition c)
      Scrolls mouse until the condition is true, with specified timeout
      static void scrollUpUntil​(int timeout, Condition c)
      Scrolls mouse wheel up until Condition is true or timeout is met
      static void scrollUpWhile​(int timeout, Condition c)
      Deprecated.
      This method is to be replaced with scrollUpUntil instead, since it was incorrectly implemented to act the same anyways
      static void scrollWhile​(boolean up, int timeout, Condition c)
      Deprecated.
      This method is to be replaced with scrollUntil instead, since it was incorrectly implemented to act the same anyways
      static void setAlwaysHop​(boolean alwaysHop2)  
      static void setLastClickPosition​(java.awt.Point lastClickPosition2)  
      static void setLastMouseDirection​(double lastMouseDirection2)  
      static void setLastMouseMagnitude​(double lastMouseMagnitude2)  
      static void setLastMouseMoveTime​(long lastMouseMoveTime2)  
      static void setPosition​(int x, int y)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Mouse

        @Deprecated
        public Mouse()
        Deprecated.
    • Method Detail

      • getMouse

        @Deprecated
        public static Mouse getMouse()
        Deprecated.
      • setPosition

        public static void setPosition​(int x,
                                       int y)
      • getUIDCount

        public static int getUIDCount()
      • getRawOnCursorUIDs

        public static long[] getRawOnCursorUIDs()
      • getOnCursorUIDs

        public static long[] getOnCursorUIDs()
      • getContext

        @Deprecated
        public static Mouse getContext()
        Deprecated.
        Gets Mouse context
        Returns:
        the context of the mouse.
      • getIdleTime

        public static int getIdleTime()
        Gets idle time.
        Returns:
        the idle time.
      • getLastClicked

        public static java.awt.Point getLastClicked()
        Gets last clicked position by the client
        Returns:
        the position of the last mouse click the client performed
      • getLastClickedX

        public static int getLastClickedX()
        Gets last clicked x position by the client
        Returns:
        the x position of the last mouse click the client performed
      • getLastClickedY

        public static int getLastClickedY()
        Gets last clicked y position by the client
        Returns:
        the y position of the last mouse click the client performed
      • getX

        public static int getX()
        Gets the current mouse X coordinate of the mouse if inside the canvas.
        Returns:
        X coordinate of the mouse if currently inside the canvas, otherwise -1;
      • getY

        public static int getY()
        Gets the current mouse Y coordinate of the mouse if inside the canvas.
        Returns:
        Y coordinate of the mouse if currently inside the canvas, otherwise -1;
      • getPosition

        public static java.awt.Point getPosition()
        Gets the current mouse position on the game canvas if the canvas contains the mouse.
        Returns:
        Point of the position of the mouse if on canvas, otherwise returns -1 for both X and Y coordinates.
      • getMouseSettings

        public static MouseSettings getMouseSettings()
        Grabs the MouseSettings
      • getCrosshairColorID

        public static int getCrosshairColorID()
        Gets the current crosshair color of the mouse.
        Returns:
        0, 1, 2
      • getCrosshairState

        public static CrosshairState getCrosshairState()
        Gets the current crosshair color of the mouse.
        Returns:
        Crosshair state
      • getLastCrosshairColorID

        public static int getLastCrosshairColorID()
        Gets the crosshair color from the last click.
        Returns:
        0, 1, 2
      • getEntitiesOnCursor

        public static java.util.List<Entity> getEntitiesOnCursor()
        Gets a list of the entities that the cursor is hovering over
        Returns:
        list of entities
      • click

        public static boolean click​(java.awt.Rectangle destination)
        Moves mouse to rectangle, and preforms left click.
        Parameters:
        destination - The rectangle destination you wish click.
        Returns:
        true if clicked successfully.
      • click

        public static boolean click​(java.awt.Rectangle destination,
                                    boolean right)
        Moves mouse to rectangle, and preforms desired type of click, as determines by arguments.
        Parameters:
        destination - The rectangle destination you wish click.
        right - The type of click you wish to preform, right click if true, otherwise left click.
        Returns:
        true if clicked successfully.
      • click

        public static boolean click​(java.awt.Point destination)
        Moves mouse to point, and preforms left click.
        Parameters:
        destination - The point destination you wish click.
        Returns:
        true if clicked successfully.
      • click

        public static boolean click​(java.awt.Point destination,
                                    boolean right)
        Moves mouse to point, and preforms desired type of click, as determines by arguments.
        Parameters:
        destination - The point destination you wish click.
        right - The type of click you wish to preform, right click if true, otherwise left click.
        Returns:
        true if clicked successfully.
      • click

        public static boolean click​(Entity destination)
        Moves mouse to entity, and preforms left click.
        Parameters:
        destination - The Entity destination you wish click.
        Returns:
        true if clicked successfully.
      • click

        public static boolean click​(Entity destination,
                                    boolean right)
        Moves mouse to entity, and preforms desired type of click, as determines by arguments.
        Parameters:
        destination - The Entity destination you wish click.
        right - The type of click you wish to preform, right click if true, otherwise left click.
        Returns:
        true if clicked successfully.
      • click

        public static boolean click​(AbstractMouseDestination destination,
                                    boolean right)
        Moves mouse to destination, and preforms desired type of click, as determines by arguments.
        Parameters:
        destination - The destination you wish click.
        right - The type of click you wish to preform, right click if true, otherwise left click.
        Returns:
        true if clicked successfully.
      • click

        public static boolean click()
        Triggers a left click
        Returns:
        true if clicked successfully
      • click

        public static boolean click​(boolean right)
        Triggers a left click
        Returns:
        true if clicked successfully
      • click

        public static boolean click​(ClickMode mode)
        Triggers a click as determined by the ClickMode
        Returns:
        true if clicked successfully
      • click

        public static boolean click​(AbstractMouseDestination destination)
        Moves mouse to destination, and preforms left click.
        Parameters:
        destination - The destination you wish click.
        Returns:
        true if clicked successfully.
      • mouseDownWhile

        public static void mouseDownWhile​(int timeout,
                                          Condition c)
        Hold mouse down until condition is true, with specified timeout
        Parameters:
        timeout - timeout in milliseconds
        c - condition to check
      • scrollWhile

        @Deprecated
        public static void scrollWhile​(boolean up,
                                       int timeout,
                                       Condition c)
        Deprecated.
        This method is to be replaced with scrollUntil instead, since it was incorrectly implemented to act the same anyways
        Scrolls mouse until the condition is true, with specified timeout
        Parameters:
        up - true to scroll up
        timeout - timeout in milliseconds
        c - condition to check
      • scrollDownWhile

        @Deprecated
        public static void scrollDownWhile​(int timeout,
                                           Condition c)
        Deprecated.
        This method is to be replaced with scrollDownUntil instead, since it was incorrectly implemented to act the same anyways
        Scrolls mouse wheel down until Condition or timeout is met
        Parameters:
        timeout - timeout in milliseconds
        c - Condition to check
      • scrollUpWhile

        @Deprecated
        public static void scrollUpWhile​(int timeout,
                                         Condition c)
        Deprecated.
        This method is to be replaced with scrollUpUntil instead, since it was incorrectly implemented to act the same anyways
        Scrolls mouse wheel up until Condition or timeout is met
        Parameters:
        timeout - timeout in milliseconds
        c - Condition to check
      • scrollUntil

        public static void scrollUntil​(boolean up,
                                       int timeout,
                                       Condition c)
        Scrolls mouse until the condition is true, with specified timeout
        Parameters:
        up - true to scroll up
        timeout - timeout in milliseconds
        c - condition to check
      • scrollDownUntil

        public static void scrollDownUntil​(int timeout,
                                           Condition c)
        Scrolls mouse wheel down until Condition is true or timeout is met
        Parameters:
        timeout - timeout in milliseconds
        c - Condition to check
      • scrollUpUntil

        public static void scrollUpUntil​(int timeout,
                                         Condition c)
        Scrolls mouse wheel up until Condition is true or timeout is met
        Parameters:
        timeout - timeout in milliseconds
        c - Condition to check
      • move

        public static boolean move​(java.awt.Rectangle rectangle)
        Moves the mouse to a specified rectangle
        Parameters:
        rectangle - The rectangle to move the mouse to.
        Returns:
        true if mouse moved successfully
      • move

        public static boolean move​(Entity entity)
        Moves the mouse to a destination
        Parameters:
        entity - the Entity which to move the mouse to.
        Returns:
        true if mouse moved successfully, otherwise false.
      • move

        public static boolean move​(java.awt.Point point)
        Moves the mouse to a specified point
        Parameters:
        point - The point to move the mouse to.
        Returns:
        true if mouse moved successfully
      • move

        public static boolean move​(Tile tile)
      • move

        public static boolean move​(AbstractMouseDestination destination)
        Moves the mouse to a destination
        Parameters:
        destination - Destination to move the mouse to.
        Returns:
        true if mouse moved successfully
      • move

        public static boolean move()
        Moves the mouse to random gaussian distributed destination near the location of your current position if the mouse is on screen, otherwise will base position from center of canvas.
        Returns:
        true if mouse moved successfully, otherwise false.
      • drag

        public static boolean drag​(java.awt.Point point)
        Drags the mouse from current point to the given point
        Parameters:
        point - Point to drag mouse to
        Returns:
        True if successfully dragged, else false
      • drag

        public static boolean drag​(Tile tile)
        Drags the mouse from the current point to the given Tile
        Parameters:
        tile - Tile to drag mouse to
        Returns:
        True if successfully dragged, else false
      • drag

        public static boolean drag​(Entity entity)
        Drags the mouse from the current position to the given Entity
        Parameters:
        entity - Entity to drag mouse to
        Returns:
        True if successfully dragged, else false
      • drag

        public static boolean drag​(java.awt.Rectangle rectangle)
        Drags the mouse from current position to the given Rectangle
        Parameters:
        rectangle - The rectangle to drag the mouse to.
        Returns:
        True if successfully dragged, else false
      • drag

        public static boolean drag​(AbstractMouseDestination destination)
        Drags the mouse to the given AbstractMouseDestination
        Parameters:
        destination - AbstractMouseDestination to drag mouse to
        Returns:
        True if successfully dragged, else false
      • moveMouseOutsideScreen

        public static boolean moveMouseOutsideScreen()
        Moves the mouse outside of the screen
        Returns:
        true if mouse moved successfully
      • isMouseInScreen

        public static boolean isMouseInScreen()
        Method to determine if the mouse cursor is in the screen.
        Returns:
        True if mouse is in the screen
      • hop

        public static boolean hop​(java.awt.Point destination)
        Method to 'hop' the mouse position, instantly.
        Parameters:
        destination - Point to jump to
        Returns:
        True if succeeded.
      • hop

        public static boolean hop​(int x,
                                  int y)
        Method to 'hop' the mouse position, instantly.
        Parameters:
        x - X-coordinate
        y - Y-coordinate
        Returns:
        True if succeeded.
      • getPointOutsideScreen

        public static java.awt.Point getPointOutsideScreen()
      • setLastClickPosition

        public static void setLastClickPosition​(java.awt.Point lastClickPosition2)
      • getLastMouseMagnitude

        public static double getLastMouseMagnitude()
      • setLastMouseMagnitude

        public static void setLastMouseMagnitude​(double lastMouseMagnitude2)
      • getLastMouseDirection

        public static double getLastMouseDirection()
      • setLastMouseDirection

        public static void setLastMouseDirection​(double lastMouseDirection2)
      • getLastMouseMoveTime

        public static long getLastMouseMoveTime()
      • setLastMouseMoveTime

        public static void setLastMouseMoveTime​(long lastMouseMoveTime2)
      • getMouseMoveResetTimeMillis

        public static long getMouseMoveResetTimeMillis()
      • isAlwaysHop

        public static boolean isAlwaysHop()
      • setAlwaysHop

        public static void setAlwaysHop​(boolean alwaysHop2)
      • getRSLastClickedX

        public static int getRSLastClickedX()
      • getRSLastClickedY

        public static int getRSLastClickedY()