Package org.dreambot.api.methods.widget
Class Widgets
- java.lang.Object
-
- org.dreambot.api.methods.widget.Widgets
-
public class Widgets extends java.lang.Object
API class revolving aroundWidget
andWidgetChild
It should be noted thatWidget
is essentially just a container ofWidgetChild
Logic in general should not be applied toWidget
and should instead be focused onWidgetChild
-
-
Constructor Summary
Constructors Constructor Description Widgets()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
closeAll()
This will attempt to close out of any interfaces that might be opened that are on the game screenstatic @Nullable WidgetChild
get(int @NonNull ... ids)
GetsWidgetChild
based on the given ids Null checks each layerstatic @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.static @Nullable WidgetChild
get(@NonNull Filter<WidgetChild> filter)
Returns the first widget matching the filter, terminating as soon as one is found.static @NonNull java.util.List<WidgetChild>
getAll(@NonNull Filter<WidgetChild> filter)
Gets a List of widget children that match the filter providedstatic @NonNull java.util.List<WidgetChild>
getAllContainingText(java.lang.String text)
Gets a list of theWidgetChild
containing a particular search string Try to avoid using this method if you can (ie.static @NonNull java.util.List<Widget>
getAllWidgets()
Gets all theWidget
sstatic @Nullable WidgetChild
getChildWidget(int parent, int child)
Deprecated.seeget(int...)
static @Nullable WidgetChild
getMatchingWidget(@NonNull Filter<WidgetChild> filter)
Deprecated.static @Nullable WidgetChild
getSelected()
static @Nullable WidgetChild
getSelectedWidget()
Deprecated.seegetSelected()
static int
getSelectedWidgetId()
Gets the currently selected widget ID (child ID) -1 if none selectedstatic int
getSelectedWidgetIndex()
Gets the currently selected widget index (grandchild ID) -1 if selected widget is not a grandchild or if none selectedstatic @Nullable Widget
getWidget(int id)
Gets top level parentWidget
based on the idstatic @Nullable WidgetChild
getWidgetChild(int @NonNull ... ids)
Deprecated.static @NonNull java.util.List<WidgetChild>
getWidgetChildrenContainingText(java.lang.String text)
Deprecated.static @NonNull java.util.List<WidgetChild>
getWidgets(@NonNull Filter<WidgetChild> filter)
Deprecated.seegetAll(Filter)
static int[]
getWidgetXArray()
Gets the widget x arraystatic int[]
getWidgetYArray()
Gets the widget y arraystatic boolean
isOpen()
This checks if any non-default interfaces are open that block the game screen (even partially)static boolean
isVisible(int @NonNull ... ids)
Checks if aWidgetChild
is visiblestatic boolean
isWidgetSelected()
Checks to see if you have a widget selectedstatic void
setSelectedWidgetId(int id)
static void
setSelectedWidgetIndex(int index)
-
-
-
Method Detail
-
getAllWidgets
public static @NonNull java.util.List<Widget> getAllWidgets()
Gets all theWidget
sThis 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 parentWidget
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.seeget(int...)
-
get
public static @Nullable WidgetChild get(int @NonNull ... ids)
GetsWidgetChild
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.seeget(int...)
-
isVisible
public static boolean isVisible(int @NonNull ... ids)
Checks if aWidgetChild
is visible- Parameters:
ids
- ids to check, parent being first, child second, etc seeget(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 theWidgetChild
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)
Deprecated.
-
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 onfilter
- Filter to pass widget children through- Returns:
- The first widget child if found, otherwise null
-
getMatchingWidget
@Deprecated public static @Nullable WidgetChild getMatchingWidget(@NonNull Filter<WidgetChild> filter)
Deprecated.seeget(Filter)
-
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
-
getWidgets
@Deprecated public static @NonNull java.util.List<WidgetChild> getWidgets(@NonNull Filter<WidgetChild> filter)
Deprecated.seegetAll(Filter)
-
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)
-
getSelected
public static @Nullable WidgetChild getSelected()
- Returns:
- The currently selected
WidgetChild
or null if none selected
-
getSelectedWidget
@Deprecated public static @Nullable WidgetChild getSelectedWidget()
Deprecated.seegetSelected()
-
-