Class Players

java.lang.Object
com.valhalla.sdk.api.methods.Players

public final class Players extends Object
Local-player access backed by the current native version adapter.
  • Method Details

    • getLocal

      public static LocalPlayer getLocal()
      Returns the lightweight local-player snapshot.
      Returns:
      the lightweight local-player snapshot
    • all

      public static List<Player> all()
      Returns all players in the loaded scene.
      Returns:
      all players in the loaded scene
    • all

      public static List<Player> all(Filter<Player> filter)
      Filters the loaded players.
      Parameters:
      filter - predicate applied to each player
      Returns:
      matching player snapshots in native enumeration order
    • all

      public static List<Player> all(Integer... indexes)
      Selects players by scene index.
      Parameters:
      indexes - indexes to include; null elements are ignored
      Returns:
      matching player snapshots
    • all

      public static List<Player> all(String... names)
      Selects players by case-insensitive exact name.
      Parameters:
      names - names to include; null elements are ignored
      Returns:
      matching player snapshots
    • getLocalEntity

      public static Optional<Player> getLocalEntity()
      Returns the full player entity marked local, when enumerated.
      Returns:
      the full player entity marked local, when enumerated
    • getByIndex

      public static Optional<Player> getByIndex(int index)
      Finds a player by scene index.
      Parameters:
      index - player scene index
      Returns:
      the matching player, if loaded
    • getAtIndex

      public static Optional<Player> getAtIndex(int index)
      Compatibility alias for getByIndex(int).
      Parameters:
      index - player scene index
      Returns:
      the matching player, if loaded
    • referenceExists

      public static boolean referenceExists(int index)
      Tests whether a player scene reference is still loaded.
      Parameters:
      index - player scene index
      Returns:
      true when the player is present
    • getArray

      public static Player[] getArray()
      Returns a new array containing all loaded players.
      Returns:
      a new array containing all loaded players
    • getByName

      public static Optional<Player> getByName(String name)
      Finds a player by case-insensitive exact name.
      Parameters:
      name - player name
      Returns:
      the matching player, if loaded
    • nearest

      public static Optional<Player> nearest()
      Returns the nearest non-local player on the current plane.
      Returns:
      the nearest non-local player on the current plane
    • closest

      public static Optional<Player> closest()
      Returns the nearest non-local player on the current plane.
      Returns:
      the nearest non-local player on the current plane
    • closest

      public static Optional<Player> closest(Filter<Player> filter)
      Compatibility alias for nearest(Filter).
      Parameters:
      filter - predicate applied before measuring distance
      Returns:
      the nearest matching player
    • closest

      public static Optional<Player> closest(Filter<Player> filter, Tile toTile)
      Finds the nearest matching player to an arbitrary tile.
      Parameters:
      filter - predicate applied before measuring distance
      toTile - origin tile used for distance comparisons
      Returns:
      the nearest matching player on the tile's plane
    • closest

      public static Optional<Player> closest(Integer... indexes)
      Finds the nearest player whose index is listed.
      Parameters:
      indexes - acceptable player scene indexes
      Returns:
      the nearest matching player
    • closest

      public static Optional<Player> closest(String... names)
      Finds the nearest player whose name is listed.
      Parameters:
      names - acceptable case-insensitive exact names
      Returns:
      the nearest matching player
    • nearest

      public static Optional<Player> nearest(Filter<Player> filter)
      Finds the nearest matching non-local player on the current plane.
      Parameters:
      filter - predicate applied before measuring distance
      Returns:
      the nearest matching player
    • getTile

      public static Tile getTile()
      Returns the local player's current world tile.
      Returns:
      the local player's current world tile
    • isMoving

      public static boolean isMoving()
      Returns true while the local player has queued movement.
      Returns:
      true while the local player has queued movement
    • getWalkingQueue

      public static List<Tile> getWalkingQueue()
      Returns a snapshot of the local player's queued walking tiles.
      Returns:
      a snapshot of the local player's queued walking tiles
    • getWalkingDestination

      public static Optional<Tile> getWalkingDestination()
      Returns the final queued walking tile, when movement is queued.
      Returns:
      the final queued walking tile, when movement is queued
    • getNextStep

      public static Optional<Tile> getNextStep()
      Returns the next queued walking tile, when movement is queued.
      Returns:
      the next queued walking tile, when movement is queued
    • distanceTo

      public static int distanceTo(Tile tile)
      Measures Chebyshev tile distance from the local player.
      Parameters:
      tile - destination tile
      Returns:
      tile distance, or Integer.MAX_VALUE across planes
    • isInArea

      public static boolean isInArea(Area area)
      Tests whether the local player's tile is inside an area.
      Parameters:
      area - area to test
      Returns:
      true when the player is inside
    • count

      public static int count(Filter<Player> filter)
      Counts loaded players accepted by a predicate.
      Parameters:
      filter - predicate applied to each player
      Returns:
      number of matching players
    • exists

      public static boolean exists(Filter<Player> filter)
      Tests whether any loaded player matches a predicate.
      Parameters:
      filter - predicate applied to each player
      Returns:
      true when a match exists