Class Widgets


  • public class Widgets
    extends java.lang.Object
    API class revolving around Widget and WidgetChild It should be noted that Widget is essentially just a container of WidgetChild Logic in general should not be applied to Widget and should instead be focused on WidgetChild
    • Constructor Detail

      • Widgets

        public Widgets()
    • Method Detail

      • getAllWidgets

        public static @NonNull java.util.List<Widget> getAllWidgets()
        Gets all the Widgets

        This method has a lot of overhead, so call it as little as possible.

        Returns:
        list of all parent Widgets
      • getWidget

        public static @Nullable Widget getWidget​(int id)
        Gets top level parent Widget based on the id
        Parameters:
        id - of the widget to find
        Returns:
        the widget matching the id
      • getChildWidget

        @Deprecated
        public static @Nullable WidgetChild getChildWidget​(int parent,
                                                           int child)
        Deprecated.
      • get

        public static @Nullable WidgetChild get​(int @NonNull ... ids)
        Gets WidgetChild based on the given ids Null checks each layer
        Parameters:
        ids - ids to check, parent being first, child second, etc
        Returns:
        Widget child matching the ids or null
      • getWidgetChild

        @Deprecated
        public static @Nullable WidgetChild getWidgetChild​(int @NonNull ... ids)
        Deprecated.
      • isVisible

        public static boolean isVisible​(int @NonNull ... ids)
        Checks if a WidgetChild is visible
        Parameters:
        ids - ids to check, parent being first, child second, etc see get(int...)
        Returns:
        True if the widget is not null and visible, else false
      • getAllContainingText

        public static @NonNull java.util.List<WidgetChild> getAllContainingText​(java.lang.String text)
        Gets a list of the WidgetChild containing a particular search string Try to avoid using this method if you can (ie. if you know the Widget parent ID, search manually) This method will search all children
        Parameters:
        text - text to search for. Case sensitive
        Returns:
        list of widget children with message containing search text
      • getWidgetChildrenContainingText

        @Deprecated
        public static @NonNull java.util.List<WidgetChild> getWidgetChildrenContainingText​(java.lang.String text)
      • get

        public static @Nullable WidgetChild get​(@NonNull Filter<WidgetChild> filter)
        Returns the first widget matching the filter, terminating as soon as one is found. Useful for minimizing resource usage.
        Parameters:
        filter - Filter to pass widget children through
        Returns:
        The first widget child if found, otherwise null
      • get

        public static @Nullable WidgetChild get​(int parent,
                                                @NonNull Filter<WidgetChild> filter)
        Returns the first widget matching the filter for the given parent ID, terminating as soon as one is found. Useful for minimizing resource usage.
        Parameters:
        parent - ID of the parent widget to filter down on
        filter - Filter to pass widget children through
        Returns:
        The first widget child if found, otherwise null
      • getAll

        public static @NonNull java.util.List<WidgetChild> getAll​(@NonNull Filter<WidgetChild> filter)
        Gets a List of widget children that match the filter provided
        Parameters:
        filter - Filter to pass widget children through
        Returns:
        List of Widget children that pass the filter provided
      • isOpen

        public static boolean isOpen()
        This checks if any non-default interfaces are open that block the game screen (even partially)
        Returns:
        true if at least one is found, false otherwise
      • closeAll

        public static boolean closeAll()
        This will attempt to close out of any interfaces that might be opened that are on the game screen
        Returns:
        true if we can't find any open screen blocking interfaces after closing if necessary, false otherwise
      • getWidgetYArray

        public static int[] getWidgetYArray()
        Gets the widget y array
        Returns:
        widget Y array
      • getWidgetXArray

        public static int[] getWidgetXArray()
        Gets the widget x array
        Returns:
        widget X array
      • isWidgetSelected

        public static boolean isWidgetSelected()
        Checks to see if you have a widget selected
      • getSelectedWidgetId

        public static int getSelectedWidgetId()
        Gets the currently selected widget ID (child ID) -1 if none selected
      • setSelectedWidgetId

        public static void setSelectedWidgetId​(int id)
      • getSelectedWidgetIndex

        public static int getSelectedWidgetIndex()
        Gets the currently selected widget index (grandchild ID) -1 if selected widget is not a grandchild or if none selected
      • setSelectedWidgetIndex

        public static void setSelectedWidgetIndex​(int index)