Interface PlayerSearch
public interface PlayerSearch
Fluent filter chain over the loaded players, returned by
ctx.players.query(). Elements are RuneLite
Players.
The hook takes the player list on the client thread. Custom predicates run on the caller's thread;
built-in name/location reads and nearest selection marshal onto the client thread. Filters narrow the search in place, so a search
is single-use. An empty result can mean "nothing matches" or "the scene could not be read"; check
ctx.game.isLoggedIn() before acting on an absence.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe facade that hands out searches:ctx.players. -
Method Summary
Modifier and TypeMethodDescriptionnet.runelite.api.Playerclosest()net.runelite.api.Playernet.runelite.api.Playerfirst()net.runelite.api.PlayerinteractingWith(net.runelite.api.Actor target) List<net.runelite.api.Player> list()net.runelite.api.Playernearest()net.runelite.api.PlayerplayerIds(int... pids) List<net.runelite.api.Player> result()booleantest(net.runelite.api.Player player) Alias offilter(Predicate).withinTiles(int maxTiles)
-
Method Details
-
playerIds
- Parameters:
pids- player ids to keep- Returns:
- this search
-
filter
- Parameters:
pred- a further test; null adds nothing- Returns:
- this search
-
where
Alias offilter(Predicate).- Parameters:
pred- a further test; null adds nothing- Returns:
- this search
-
withName
- Parameters:
names- case-insensitive name fragments; a player matching any one is kept- Returns:
- this search
-
excludeLocal
PlayerSearch excludeLocal()- Returns:
- this search, without the local player
-
withinTiles
- Parameters:
maxTiles- the most tiles from the local player- Returns:
- this search
-
interactingWith
- Parameters:
target- the actor the players must be interacting with; null keeps nobody- Returns:
- this search
-
result
List<net.runelite.api.Player> result()- Returns:
- every match
-
list
-
first
net.runelite.api.Player first()- Returns:
- the first match, or null
-
first
- Parameters:
pred- a further test- Returns:
- the first match, or null
-
closest
net.runelite.api.Player closest()- Returns:
- the match nearest the local player, or null
-
closest
- Parameters:
pred- a further test- Returns:
- the match nearest the local player, or null
-
nearest
net.runelite.api.Player nearest()- Returns:
- the match nearest the local player, or null; the same as
closest()
-
nearest
- Parameters:
pred- a further test- Returns:
- the match nearest the local player, or null; the same as
closest(Predicate)
-
test
boolean test(net.runelite.api.Player player) - Parameters:
player- a player- Returns:
- whether it passes every filter of this search
-