Package org.dreambot.api.methods.widget
Class Widgets
- java.lang.Object
-
- org.dreambot.api.methods.widget.Widgets
-
public class Widgets extends java.lang.ObjectAPI class revolving aroundWidgetandWidgetChildIt should be noted thatWidgetis essentially just a container ofWidgetChildLogic in general should not be applied toWidgetand 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 booleancloseAll()This will attempt to close out of any interfaces that might be opened that are on the game screenstatic @Nullable WidgetChildget(int @NonNull ... ids)GetsWidgetChildbased on the given ids Null checks each layerstatic @Nullable WidgetChildget(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 WidgetChildget(@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 theWidgetChildcontaining a particular search string Try to avoid using this method if you can (ie.static @NonNull java.util.List<Widget>getAllWidgets()Gets all theWidgetsstatic @Nullable WidgetChildgetChildWidget(int parent, int child)Deprecated.seeget(int...)static @Nullable WidgetChildgetMatchingWidget(@NonNull Filter<WidgetChild> filter)Deprecated.static @Nullable WidgetChildgetSelected()static @Nullable WidgetChildgetSelectedWidget()Deprecated.seegetSelected()static intgetSelectedWidgetId()Gets the currently selected widget ID (child ID) -1 if none selectedstatic intgetSelectedWidgetIndex()Gets the currently selected widget index (grandchild ID) -1 if selected widget is not a grandchild or if none selectedstatic @Nullable WidgetgetWidget(int id)Gets top level parentWidgetbased on the idstatic @Nullable WidgetChildgetWidgetChild(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 booleanisOpen()This checks if any non-default interfaces are open that block the game screen (even partially)static booleanisVisible(int @NonNull ... ids)Checks if aWidgetChildis visiblestatic booleanisWidgetSelected()Checks to see if you have a widget selectedstatic voidsetSelectedWidgetId(int id)static voidsetSelectedWidgetIndex(int index)
-
-
-
Method Detail
-
getAllWidgets
public static @NonNull java.util.List<Widget> getAllWidgets()
Gets all theWidgetsThis 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 parentWidgetbased 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)
GetsWidgetChildbased 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 aWidgetChildis 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 theWidgetChildcontaining 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
WidgetChildor null if none selected
-
getSelectedWidget
@Deprecated public static @Nullable WidgetChild getSelectedWidget()
Deprecated.seegetSelected()
-
-