Package net.eternalclient.api.accessors
Class Widgets
- java.lang.Object
-
- net.eternalclient.api.accessors.Widgets
-
public class Widgets extends java.lang.ObjectThis class provides utility methods for interacting with widgets.
-
-
Constructor Summary
Constructors Constructor Description Widgets()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancanCloseWidgets()Checks if there are any widgets with close button texture and close action available.static booleancanCloseWidgetsExcept(java.util.function.Predicate<WidgetChild> predicate)Checks if there are any widgets that can be closed, excluding those that satisfy the given predicate.static voidcloseAll()Closes all widgets that have a specific texture and contain the action "Close".static voidcloseAllExcept(java.util.function.Predicate<WidgetChild> predicate)Closes all widget children that meet the given predicate criteria, excluding those with a "Close" action and not matching the specified CLOSE_BUTTON_TEXTURE.static java.util.List<Widget>getAllVisibleWidgets()Returns a list of all visible widgets.static java.util.List<Widget>getAllWidgets()Returns a list of all widgets by loading widget parents and creating new widgets for each parent ID.static java.awt.RectanglegetViewRectangle()Returns the Rectangle object representing the view rectangle.static WidgetgetWidget(int parentId)Returns a new Widget object with the specified parent ID.static WidgetChildgetWidgetChild(int... widgetIDs)Returns a WidgetChild object based on the provided widget IDs.static WidgetChildgetWidgetChild(int parent, int child, java.util.function.Predicate<WidgetChild> predicate)Retrieves a specific child widget based on the given parent and child indexes, using the provided predicate to determine which child to return.static WidgetChildgetWidgetChild(int parent, java.util.function.Predicate<WidgetChild> predicate)Retrieves the first WidgetChild, in the given parent Widget, that satisfies the provided predicate.static WidgetChildgetWidgetChild(java.util.function.Predicate<WidgetChild> predicate)Retrieves the first WidgetChild that matches the given predicate among the visible widgets and their descendants.static WidgetChildgetWidgetChild(java.util.List<java.lang.Integer> ids)Returns the WidgetChild with the given list of ids.static WidgetChildgetWidgetChild(net.eternalclient.api.data.widgets.WidgetInfo widgetInfo)Returns the WidgetChild for the given WidgetInfo.static java.util.List<WidgetChild>getWidgetChildrenContainingText(java.lang.String text)Returns a list of WidgetChild objects that contain the specified text, ignoring case sensitivity.static java.util.List<WidgetChild>getWidgets(int parentId)Retrieves the visible children of a widget specified by its parent ID.static java.util.List<WidgetChild>getWidgets(int parentId, java.util.function.Predicate<WidgetChild> predicate)Retrieves a list of WidgetChild objects based on the specified parent ID and predicate.static java.util.List<WidgetChild>getWidgets(java.util.function.Predicate<WidgetChild> predicate)Returns a list of WidgetChildren that satisfy the given predicate.static java.util.Map<WidgetChild,java.util.List<WidgetChild>>getWidgetsAndChildren(java.util.List<Widget> widgets, java.util.function.Predicate<WidgetChild> predicate)Retrieves a map of WidgetChild objects as keys, and their corresponding List of WidgetChild objects as values, based on the given list of Widget objects and the provided Predicate.
-
-
-
Method Detail
-
canCloseWidgets
public static boolean canCloseWidgets()
Checks if there are any widgets with close button texture and close action available.- Returns:
- true if there are widgets that can be closed, otherwise false.
-
canCloseWidgetsExcept
public static boolean canCloseWidgetsExcept(java.util.function.Predicate<WidgetChild> predicate)
Checks if there are any widgets that can be closed, excluding those that satisfy the given predicate.- Parameters:
predicate- the condition that determines which widgets to exclude- Returns:
- true if there are widgets that can be closed and do not satisfy the given predicate, false otherwise
-
closeAll
public static void closeAll()
Closes all widgets that have a specific texture and contain the action "Close".
-
closeAllExcept
public static void closeAllExcept(java.util.function.Predicate<WidgetChild> predicate)
Closes all widget children that meet the given predicate criteria, excluding those with a "Close" action and not matching the specified CLOSE_BUTTON_TEXTURE.- Parameters:
predicate- the predicate used to filter the widgets to close
-
getAllWidgets
public static java.util.List<Widget> getAllWidgets()
Returns a list of all widgets by loading widget parents and creating new widgets for each parent ID.- Returns:
- List of all widgets.
-
getAllVisibleWidgets
public static java.util.List<Widget> getAllVisibleWidgets()
Returns a list of all visible widgets.- Returns:
- a list of all visible widgets
-
getWidget
public static Widget getWidget(int parentId)
Returns a new Widget object with the specified parent ID.- Parameters:
parentId- the ID of the parent for the Widget- Returns:
- a new Widget object with the given parent ID
-
getWidgets
public static java.util.List<WidgetChild> getWidgets(int parentId)
Retrieves the visible children of a widget specified by its parent ID.- Parameters:
parentId- the ID of the parent widget- Returns:
- a list of visible WidgetChild objects
-
getWidgets
public static java.util.List<WidgetChild> getWidgets(java.util.function.Predicate<WidgetChild> predicate)
Returns a list of WidgetChildren that satisfy the given predicate.- Parameters:
predicate- the predicate to test WidgetChildren against- Returns:
- the list of WidgetChildren that satisfy the predicate
-
getWidgets
public static java.util.List<WidgetChild> getWidgets(int parentId, java.util.function.Predicate<WidgetChild> predicate)
Retrieves a list of WidgetChild objects based on the specified parent ID and predicate.- Parameters:
parentId- The ID of the parent Widget.predicate- The predicate used to filter the WidgetChild objects.- Returns:
- A list of WidgetChild objects that satisfy the given predicate.
-
getWidgetsAndChildren
public static java.util.Map<WidgetChild,java.util.List<WidgetChild>> getWidgetsAndChildren(java.util.List<Widget> widgets, java.util.function.Predicate<WidgetChild> predicate)
Retrieves a map of WidgetChild objects as keys, and their corresponding List of WidgetChild objects as values, based on the given list of Widget objects and the provided Predicate.- Parameters:
widgets- the list of Widget objects to search throughpredicate- the Predicate used to test WidgetChild objects- Returns:
- a map containing WidgetChild objects and their respective lists of WidgetChild objects
-
getWidgetChildrenContainingText
public static java.util.List<WidgetChild> getWidgetChildrenContainingText(java.lang.String text)
Returns a list of WidgetChild objects that contain the specified text, ignoring case sensitivity.- Parameters:
text- the text to search for within the WidgetChild objects- Returns:
- a list of WidgetChild objects containing the specified text
-
getWidgetChild
public static WidgetChild getWidgetChild(net.eternalclient.api.data.widgets.WidgetInfo widgetInfo)
Returns the WidgetChild for the given WidgetInfo.- Parameters:
widgetInfo- the WidgetInfo object representing the widget- Returns:
- the WidgetChild object
-
getWidgetChild
public static WidgetChild getWidgetChild(java.util.List<java.lang.Integer> ids)
Returns the WidgetChild with the given list of ids.- Parameters:
ids- the list of ids representing the location of the WidgetChild- Returns:
- the WidgetChild found or null if not found
-
getWidgetChild
public static WidgetChild getWidgetChild(java.util.function.Predicate<WidgetChild> predicate)
Retrieves the first WidgetChild that matches the given predicate among the visible widgets and their descendants.- Parameters:
predicate- the predicate to test each widget child against- Returns:
- the first widget child that matches the predicate, or null if no match is found
-
getWidgetChild
public static WidgetChild getWidgetChild(int parent, java.util.function.Predicate<WidgetChild> predicate)
Retrieves the first WidgetChild, in the given parent Widget, that satisfies the provided predicate.- Parameters:
parent- the parent widget identifier.predicate- the function used to test the WidgetChild.- Returns:
- the first WidgetChild that satisfies the predicate, or null if no WidgetChild matches the predicate.
-
getWidgetChild
public static WidgetChild getWidgetChild(int parent, int child, java.util.function.Predicate<WidgetChild> predicate)
Retrieves a specific child widget based on the given parent and child indexes, using the provided predicate to determine which child to return.- Parameters:
parent- the parent widget indexchild- the child widget indexpredicate- the predicate used to determine which child to return- Returns:
- the specific child widget that matches the predicate, or null if no matching child is found
-
getWidgetChild
public static WidgetChild getWidgetChild(int... widgetIDs)
Returns a WidgetChild object based on the provided widget IDs.- Parameters:
widgetIDs- - the IDs of the widgets (must have at least two values, with an optional third value for child widget)- Returns:
- WidgetChild object if found, null otherwise
-
getViewRectangle
public static java.awt.Rectangle getViewRectangle()
Returns the Rectangle object representing the view rectangle.- Returns:
- the Rectangle object representing the view rectangle, or null if the widget child is not found
-
-