PlayerQuery
A query class for filtering and retrieving Player entities in the game.
ClassRLPlugins API
public class PlayerQuery extends AbstractActorQuery<PlayerEx, PlayerQuery>Members
Inherited from AbstractQuery
- Raggregate(Function<Stream<PlayerEx>, R>)
Generic aggregation method for custom terminal operations Executes filters and allows custom stream processing.
- booleanall(Predicate<PlayerEx>)
Check if all filtered results match the predicate.
- booleanany(Predicate<PlayerEx>)
Check if any filtered result matches the predicate.
- List<PlayerEx>collect()
Get the filtered/sorted list.
- Rcollect(Collector<PlayerEx, ?, R>)
Execute filters and process with custom collector.
- intcount()
Get count of filtered results.
- PlayerQuerydistinct()
Ensure results are distinct.
- PlayerExfirst()
Get the first element from the filtered/sorted list.
- voidfirstIfPresent(Consumer<PlayerEx>)
First if present.
- voidfirstOrElse(Consumer<PlayerEx>, Runnable)
Perform action on the first element, or else run elseAction if no results.
- voidforEach(Consumer<PlayerEx>)
Executes filters and performs an action on each result.
- booleanisEmpty()
Check if there are no filtered results.
- PlayerQuerykeepIf(Predicate<PlayerEx>)
Lazily filter by predicate (keeps matching items).
- PlayerExlast()
Get the last element from the filtered/sorted list.
- voidlastOrElse(Consumer<PlayerEx>, Runnable)
Perform action on the last element, or else run elseAction if no results.
- PlayerQuerylimit(int)
Limit the number of results.
- booleannone(Predicate<PlayerEx>)
Check if no filtered results match the predicate.
- PlayerQuerypeek(Consumer<PlayerEx>)
Peek at each element during processing.
- PlayerQuerypostProcess(Function<List<PlayerEx>, List<PlayerEx>>)
Apply a post-processing function after sorting.
- PlayerExrandom()
Get a random element from the filtered/sorted list.
- PlayerQueryremoveIf(Predicate<PlayerEx>)
Lazily filter by predicate (removes matching items).
- PlayerQueryskip(int)
Skip a number of results.
- PlayerQuerysort(Comparator<PlayerEx>)
Lazily add sorting.
Inherited from AbstractActorQuery
- PlayerQueryatLocation(WorldPoint)
Filter by exact location.
- PlayerQuerycanAttack()
Filter to npcs the player can attack.
- PlayerExfarthest()
Get the farthest Actor from the filtered list Terminal operation - executes the query.
- PlayerExfarthest(WorldPoint)
Get the farthest Actor from a specific point Terminal operation - executes the query.
- PlayerQueryfree()
Filter actors that are already interacting.
- PlayerQueryhasLos()
Filter actors that the player has line of sight to.
- PlayerQueryinteractingWith(ActorEx<?>)
Filter actors that are currently interacting with a specific target actor.
- PlayerQueryisReachable()
Filter reachable actors.
- PlayerExlongestPath()
Get the Actor with the furthest path from the filtered list Terminal operation - executes the query.
- PlayerExnearest()
Get the nearest Actor from the filtered list Terminal operation - executes the query.
- PlayerExnearest(WorldPoint)
Get the nearest Actor to a specific point Terminal operation - executes the query.
- PlayerExshortestPath()
Get the Actor with the shortest path from the filtered list Terminal operation - executes the query.
- PlayerQuerysortFurthest()
Sort by furthest from the player.
- PlayerQuerysortFurthest(WorldPoint)
Sort by furthest from a specific point.
- PlayerQuerysortLongestPath()
Sort by furthest path from the player.
- PlayerQuerysortLongestPath(WorldPoint)
Sort by furthest path from a specific point.
- PlayerQuerysortNearest()
Sort by nearest to the player.
- PlayerQuerysortNearest(WorldPoint)
Sort by nearest to a specific point.
- PlayerQuerysortShortestPath()
Sort by shortest path from the player.
- PlayerQuerysortShortestPath(WorldPoint)
Sort by shortest path from a specific point.
- PlayerQuerywithin(int)
Filter by distance.
- PlayerQuerywithin(WorldPoint, int)
Filter by distance from a specific point.
- PlayerQuerywithName(String)
Filter by name.
- PlayerQuerywithNameContains(String)
Filter by name.
aggregate(Function<Stream<PlayerEx>, R>)from AbstractQuery
public R aggregate(Function<Stream<PlayerEx>, R> aggregator)Generic aggregation method for custom terminal operations Executes filters and allows custom stream processing.
Parameters
aggregator- Aggregator.
all(Predicate<PlayerEx>)from AbstractQuery
public boolean all(Predicate<PlayerEx> predicate)Check if all filtered results match the predicate.
Parameters
predicate- Predicate to test.
Returns
True if all match, false otherwise.
any(Predicate<PlayerEx>)from AbstractQuery
public boolean any(Predicate<PlayerEx> predicate)Check if any filtered result matches the predicate.
Parameters
predicate- Predicate to test.
Returns
True if any match, false otherwise.
collect()from AbstractQuery
public List<PlayerEx> collect()Get the filtered/sorted list.
collect(Collector<PlayerEx, ?, R>)from AbstractQuery
public R collect(Collector<PlayerEx, ?, R> collector)Execute filters and process with custom collector.
Parameters
collector- Collector.
count()from AbstractQuery
public int count()Get count of filtered results.
distinct()from AbstractQuery
public PlayerQuery distinct()Ensure results are distinct.
Returns
The query instance.
first()from AbstractQuery
public PlayerEx first()Get the first element from the filtered/sorted list.
firstIfPresent(Consumer<PlayerEx>)from AbstractQuery
public void firstIfPresent(Consumer<PlayerEx> action)First if present.
Parameters
action- Action.
firstOrElse(Consumer<PlayerEx>, Runnable)from AbstractQuery
public void firstOrElse(Consumer<PlayerEx> action, Runnable elseAction)Perform action on the first element, or else run elseAction if no results.
Parameters
action- Action to perform on the first element.
elseAction- Action to perform if no results.
forEach(Consumer<PlayerEx>)from AbstractQuery
public void forEach(Consumer<PlayerEx> action)Executes filters and performs an action on each result.
Parameters
action- Action.
isEmpty()from AbstractQuery
public boolean isEmpty()Check if there are no filtered results.
Returns
True if no results after filtering, false otherwise.
keepIf(Predicate<PlayerEx>)from AbstractQuery
public PlayerQuery keepIf(Predicate<PlayerEx> predicate)Lazily filter by predicate (keeps matching items).
Parameters
predicate- Predicate.
Returns
The query instance.
last()from AbstractQuery
public PlayerEx last()Get the last element from the filtered/sorted list.
lastOrElse(Consumer<PlayerEx>, Runnable)from AbstractQuery
public void lastOrElse(Consumer<PlayerEx> action, Runnable elseAction)Perform action on the last element, or else run elseAction if no results.
Parameters
action- Action to perform on the last element.
elseAction- Action to perform if no results.
limit(int)from AbstractQuery
public PlayerQuery limit(int maxSize)Limit the number of results.
Parameters
maxSize- Max size.
Returns
The query instance.
none(Predicate<PlayerEx>)from AbstractQuery
public boolean none(Predicate<PlayerEx> predicate)Check if no filtered results match the predicate.
Parameters
predicate- Predicate to test.
Returns
True if none match, false otherwise.
peek(Consumer<PlayerEx>)from AbstractQuery
public PlayerQuery peek(Consumer<PlayerEx> action)Peek at each element during processing.
Parameters
action- Action to perform on each element.
Returns
The query instance.
postProcess(Function<List<PlayerEx>, List<PlayerEx>>)from AbstractQuery
public PlayerQuery postProcess(Function<List<PlayerEx>, List<PlayerEx>> processor)Apply a post-processing function after sorting.
Useful for reordering algorithms that can't be expressed as Comparators.
Parameters
processor- Function to transform the result list.
Returns
The query instance.
random()from AbstractQuery
public PlayerEx random()Get a random element from the filtered/sorted list.
removeIf(Predicate<PlayerEx>)from AbstractQuery
public PlayerQuery removeIf(Predicate<PlayerEx> predicate)Lazily filter by predicate (removes matching items).
Parameters
predicate- Predicate.
Returns
The query instance.
skip(int)from AbstractQuery
public PlayerQuery skip(int count)Skip a number of results.
Parameters
count- Count.
Returns
The query instance.
sort(Comparator<PlayerEx>)from AbstractQuery
public PlayerQuery sort(Comparator<PlayerEx> comparator)Lazily add sorting.
Parameters
comparator- Comparator.
Returns
The query instance.
atLocation(WorldPoint)from AbstractActorQuery
public PlayerQuery atLocation(WorldPoint location)Filter by exact location.
Parameters
location- Location.
Returns
ActorQuery.
canAttack()from AbstractActorQuery
public PlayerQuery canAttack()Filter to npcs the player can attack.
Returns
ActorQuery.
farthest()from AbstractActorQuery
public PlayerEx farthest()Get the farthest Actor from the filtered list Terminal operation - executes the query.
farthest(WorldPoint)from AbstractActorQuery
public PlayerEx farthest(WorldPoint center)Get the farthest Actor from a specific point Terminal operation - executes the query.
Parameters
center- Center.
free()from AbstractActorQuery
public PlayerQuery free()Filter actors that are already interacting.
Returns
ActorQuery.
hasLos()from AbstractActorQuery
public PlayerQuery hasLos()Filter actors that the player has line of sight to.
Returns
ActorQuery.
interactingWith(ActorEx<?>)from AbstractActorQuery
public PlayerQuery interactingWith(ActorEx<?> target)Filter actors that are currently interacting with a specific target actor.
Parameters
target- Actor.
Returns
ActorQuery.
isReachable()from AbstractActorQuery
public PlayerQuery isReachable()Filter reachable actors.
Returns
ActorQuery.
longestPath()from AbstractActorQuery
public PlayerEx longestPath()Get the Actor with the furthest path from the filtered list Terminal operation - executes the query.
nearest()from AbstractActorQuery
public PlayerEx nearest()Get the nearest Actor from the filtered list Terminal operation - executes the query.
nearest(WorldPoint)from AbstractActorQuery
public PlayerEx nearest(WorldPoint center)Get the nearest Actor to a specific point Terminal operation - executes the query.
Parameters
center- Center.
shortestPath()from AbstractActorQuery
public PlayerEx shortestPath()Get the Actor with the shortest path from the filtered list Terminal operation - executes the query.
sortFurthest()from AbstractActorQuery
public PlayerQuery sortFurthest()Sort by furthest from the player.
Returns
ActorQuery.
sortFurthest(WorldPoint)from AbstractActorQuery
public PlayerQuery sortFurthest(WorldPoint center)Sort by furthest from a specific point.
Parameters
center- Center point.
Returns
ActorQuery.
sortLongestPath()from AbstractActorQuery
public PlayerQuery sortLongestPath()Sort by furthest path from the player.
Returns
ActorQuery.
sortLongestPath(WorldPoint)from AbstractActorQuery
public PlayerQuery sortLongestPath(WorldPoint center)Sort by furthest path from a specific point.
Parameters
center- Center point.
Returns
ActorQuery.
sortNearest()from AbstractActorQuery
public PlayerQuery sortNearest()Sort by nearest to the player.
Returns
ActorQuery.
sortNearest(WorldPoint)from AbstractActorQuery
public PlayerQuery sortNearest(WorldPoint center)Sort by nearest to a specific point.
Parameters
center- Center point.
Returns
ActorQuery.
sortShortestPath()from AbstractActorQuery
public PlayerQuery sortShortestPath()Sort by shortest path from the player.
Returns
ActorQuery.
sortShortestPath(WorldPoint)from AbstractActorQuery
public PlayerQuery sortShortestPath(WorldPoint center)Sort by shortest path from a specific point.
Parameters
center- Center point.
Returns
ActorQuery.
within(int)from AbstractActorQuery
public PlayerQuery within(int distance)Filter by distance.
Parameters
distance- Distance.
Returns
ActorQuery.
within(WorldPoint, int)from AbstractActorQuery
public PlayerQuery within(WorldPoint center, int distance)Filter by distance from a specific point.
Parameters
center- Center point.
distance- Distance.
Returns
ActorQuery.
withName(String)from AbstractActorQuery
public PlayerQuery withName(String name)Filter by name.
Parameters
name- Actor name.
Returns
ActorQuery.
withNameContains(String)from AbstractActorQuery
public PlayerQuery withNameContains(String name)Filter by name.
Parameters
name- Actor name.
Returns
ActorQuery.
Also allowed
Every class has these, as in plain Java.
equals, toString