Class Player

java.lang.Object
com.valhalla.sdk.api.entities.Player
All Implemented Interfaces:
Indexed, Locatable, Nameable

public final class Player extends Object implements Locatable, Indexed, Nameable
Immutable snapshot of one player from the current native world view.
  • Constructor Details

    • Player

      public Player(int index, String name, Tile tile, boolean moving, boolean local)
      Creates a player snapshot without decoded route steps.
      Parameters:
      index - current scene index
      name - captured display name, possibly blank
      tile - current world tile
      moving - whether the native client reported movement
      local - whether this snapshot represents the local player
    • Player

      public Player(int index, String name, Tile tile, boolean moving, boolean local, List<Tile> walkingQueue)
      Creates a player snapshot with a defensive copy of its walking queue.
      Parameters:
      index - current scene index
      name - captured display name, possibly blank
      tile - current world tile
      moving - whether the native client reported movement
      local - whether this snapshot represents the local player
      walkingQueue - ordered route steps captured from the client
  • Method Details

    • getIndex

      public int getIndex()
      Returns the current scene index.
      Specified by:
      getIndex in interface Indexed
      Returns:
      current scene index
    • getName

      public String getName()
      Returns the captured display name.
      Specified by:
      getName in interface Nameable
      Returns:
      captured display name, possibly blank
    • getTile

      public Tile getTile()
      Returns the captured world location.
      Specified by:
      getTile in interface Locatable
      Returns:
      current world tile captured in this snapshot
    • isMoving

      public boolean isMoving()
      Returns the captured movement state.
      Returns:
      whether movement was active when this snapshot was captured
    • isLocal

      public boolean isLocal()
      Reports whether this is the local player.
      Returns:
      whether this snapshot represents the local player
    • getWalkingQueue

      public List<Tile> getWalkingQueue()
      Returns the captured walking queue.
      Returns:
      immutable ordered walking queue captured from the client
    • getWalkingDestination

      public Optional<Tile> getWalkingDestination()
      Returns the final queued destination when it differs from the current tile.
      Returns:
      destination, or empty when no meaningful route is queued
    • getNextStep

      public Optional<Tile> getNextStep()
      Returns the first queued step that differs from the current tile.
      Returns:
      next route step, or empty when none remains
    • equals

      public boolean equals(Object value)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object