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.

  • Method Details

    • playerIds

      PlayerSearch playerIds(int... pids)
      Parameters:
      pids - player ids to keep
      Returns:
      this search
    • filter

      PlayerSearch filter(Predicate<net.runelite.api.Player> pred)
      Parameters:
      pred - a further test; null adds nothing
      Returns:
      this search
    • where

      PlayerSearch where(Predicate<net.runelite.api.Player> pred)
      Parameters:
      pred - a further test; null adds nothing
      Returns:
      this search
    • withName

      PlayerSearch withName(String... names)
      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

      PlayerSearch withinTiles(int maxTiles)
      Parameters:
      maxTiles - the most tiles from the local player
      Returns:
      this search
    • interactingWith

      PlayerSearch interactingWith(net.runelite.api.Actor target)
      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

      List<net.runelite.api.Player> list()
      Returns:
      every match; the same as result()
    • first

      net.runelite.api.Player first()
      Returns:
      the first match, or null
    • first

      net.runelite.api.Player first(Predicate<net.runelite.api.Player> pred)
      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

      net.runelite.api.Player closest(Predicate<net.runelite.api.Player> pred)
      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

      net.runelite.api.Player nearest(Predicate<net.runelite.api.Player> pred)
      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