Package net.eternalclient.api.accessors
Class NPCs
- java.lang.Object
-
- net.eternalclient.api.accessors.NPCs
-
public class NPCs extends java.lang.Object
This class provides methods to retrieve and interact with Non-Player Characters (NPCs).
-
-
Constructor Summary
Constructors Constructor Description NPCs()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<NPC>
all()
Returns a list of all non-player character (NPC) objects currently present in the game.static java.util.List<NPC>
all(java.util.function.Predicate<NPC> predicate)
Returns a list of all NPCs that satisfy the given predicate.static NPC
closest(int ID)
Returns the NPC with the closest distance to the given ID.static NPC
closest(int ID, Positionable positionable)
Returns the closest NPC with the specified ID within the same plane as the given Positionable object.static NPC
closest(java.lang.String name)
Returns the closest NPC object with the specified name.static NPC
closest(java.lang.String name, Positionable positionable)
Returns the closest NPC with the specified name to the given positionable.static NPC
closest(java.util.function.Predicate<NPC> predicate)
Returns the closest NPC that satisfies the given Predicate.static NPC
closest(java.util.function.Predicate<NPC> predicate, Positionable positionable)
Returns the closest NPC to the specified positionable that matches the given predicate, or null if none are found.static java.util.stream.Stream<NPC>
stream()
Returns a stream of all NPCs currently present in the game.static java.util.stream.Stream<NPC>
stream(java.util.function.Predicate<NPC> predicate)
Returns a stream of all NPCs that satisfy the given predicate.
-
-
-
Method Detail
-
all
public static java.util.List<NPC> all()
Returns a list of all non-player character (NPC) objects currently present in the game.- Returns:
- a list containing all valid NPC objects
-
stream
public static java.util.stream.Stream<NPC> stream()
Returns a stream of all NPCs currently present in the game.- Returns:
- a stream of all NPCs, no null values
-
all
public static java.util.List<NPC> all(java.util.function.Predicate<NPC> predicate)
Returns a list of all NPCs that satisfy the given predicate.- Parameters:
predicate
- the predicate to filter the NPCs- Returns:
- a list of NPCs that satisfy the predicate
-
stream
public static java.util.stream.Stream<NPC> stream(java.util.function.Predicate<NPC> predicate)
Returns a stream of all NPCs that satisfy the given predicate.- Parameters:
predicate
- the predicate to filter the NPCs- Returns:
- a stream of NPCs that satisfy the predicate, no null values
-
closest
public static NPC closest(java.util.function.Predicate<NPC> predicate)
Returns the closest NPC that satisfies the given Predicate.- Parameters:
predicate
- the condition to satisfy- Returns:
- the closest NPC that satisfies the predicate, or null if no NPC satisfies the predicate
-
closest
public static NPC closest(java.util.function.Predicate<NPC> predicate, Positionable positionable)
Returns the closest NPC to the specified positionable that matches the given predicate, or null if none are found.- Parameters:
predicate
- The predicate used to filter NPCs.positionable
- The positionable to find the closest NPC to.- Returns:
- The closest NPC that matches the predicate, or null if none are found.
-
closest
public static NPC closest(java.lang.String name)
Returns the closest NPC object with the specified name.- Parameters:
name
- the name of the NPC to search for.- Returns:
- the NPC object with the closest proximity to the current context and matching name.
-
closest
public static NPC closest(int ID)
Returns the NPC with the closest distance to the given ID.- Parameters:
ID
- the ID of the NPC to find the closest distance to- Returns:
- the NPC with the closest distance to the given ID
-
closest
public static NPC closest(java.lang.String name, Positionable positionable)
Returns the closest NPC with the specified name to the given positionable.- Parameters:
name
- the name of the NPCpositionable
- the positionable object used for determining the closest NPC- Returns:
- the closest NPC with the specified name to the positionable, null if not found or not on the same plane
-
closest
public static NPC closest(int ID, Positionable positionable)
Returns the closest NPC with the specified ID within the same plane as the given Positionable object. If no NPC with the specified ID is found or the planes do not match, null is returned.- Parameters:
ID
- the ID of the NPC to search forpositionable
- the Positionable object used as the reference point- Returns:
- the closest NPC with the specified ID, or null if not found or planes do not match
-
-