Package com.valhalla.sdk.api.methods
Class Players
java.lang.Object
com.valhalla.sdk.api.methods.Players
Local-player access backed by the current native version adapter.
-
Method Summary
Modifier and TypeMethodDescriptionall()Returns all players in the loaded scene.Filters the loaded players.Selects players by scene index.Selects players by case-insensitive exact name.closest()Returns the nearest non-local player on the current plane.Compatibility alias fornearest(Filter).Finds the nearest matching player to an arbitrary tile.Finds the nearest player whose index is listed.Finds the nearest player whose name is listed.static intCounts loaded players accepted by a predicate.static intdistanceTo(Tile tile) Measures Chebyshev tile distance from the local player.static booleanTests whether any loaded player matches a predicate.static Player[]getArray()Returns a new array containing all loaded players.getAtIndex(int index) Compatibility alias forgetByIndex(int).getByIndex(int index) Finds a player by scene index.Finds a player by case-insensitive exact name.static LocalPlayergetLocal()Returns the lightweight local-player snapshot.Returns the full player entity marked local, when enumerated.Returns the next queued walking tile, when movement is queued.static TilegetTile()Returns the local player's current world tile.Returns the final queued walking tile, when movement is queued.Returns a snapshot of the local player's queued walking tiles.static booleanTests whether the local player's tile is inside an area.static booleanisMoving()Returnstruewhile the local player has queued movement.nearest()Returns the nearest non-local player on the current plane.Finds the nearest matching non-local player on the current plane.static booleanreferenceExists(int index) Tests whether a player scene reference is still loaded.
-
Method Details
-
getLocal
Returns the lightweight local-player snapshot.- Returns:
- the lightweight local-player snapshot
-
all
Returns all players in the loaded scene.- Returns:
- all players in the loaded scene
-
all
Filters the loaded players.- Parameters:
filter- predicate applied to each player- Returns:
- matching player snapshots in native enumeration order
-
all
Selects players by scene index.- Parameters:
indexes- indexes to include; null elements are ignored- Returns:
- matching player snapshots
-
all
Selects players by case-insensitive exact name.- Parameters:
names- names to include; null elements are ignored- Returns:
- matching player snapshots
-
getLocalEntity
Returns the full player entity marked local, when enumerated.- Returns:
- the full player entity marked local, when enumerated
-
getByIndex
Finds a player by scene index.- Parameters:
index- player scene index- Returns:
- the matching player, if loaded
-
getAtIndex
Compatibility alias forgetByIndex(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:
truewhen the player is present
-
getArray
Returns a new array containing all loaded players.- Returns:
- a new array containing all loaded players
-
getByName
Finds a player by case-insensitive exact name.- Parameters:
name- player name- Returns:
- the matching player, if loaded
-
nearest
Returns the nearest non-local player on the current plane.- Returns:
- the nearest non-local player on the current plane
-
closest
Returns the nearest non-local player on the current plane.- Returns:
- the nearest non-local player on the current plane
-
closest
Compatibility alias fornearest(Filter).- Parameters:
filter- predicate applied before measuring distance- Returns:
- the nearest matching player
-
closest
Finds the nearest matching player to an arbitrary tile.- Parameters:
filter- predicate applied before measuring distancetoTile- origin tile used for distance comparisons- Returns:
- the nearest matching player on the tile's plane
-
closest
Finds the nearest player whose index is listed.- Parameters:
indexes- acceptable player scene indexes- Returns:
- the nearest matching player
-
closest
Finds the nearest player whose name is listed.- Parameters:
names- acceptable case-insensitive exact names- Returns:
- the nearest matching player
-
nearest
Finds the nearest matching non-local player on the current plane.- Parameters:
filter- predicate applied before measuring distance- Returns:
- the nearest matching player
-
getTile
Returns the local player's current world tile.- Returns:
- the local player's current world tile
-
isMoving
public static boolean isMoving()Returnstruewhile the local player has queued movement.- Returns:
truewhile the local player has queued movement
-
getWalkingQueue
Returns a snapshot of the local player's queued walking tiles.- Returns:
- a snapshot of the local player's queued walking tiles
-
getWalkingDestination
Returns the final queued walking tile, when movement is queued.- Returns:
- the final queued walking tile, when movement is queued
-
getNextStep
Returns the next queued walking tile, when movement is queued.- Returns:
- the next queued walking tile, when movement is queued
-
distanceTo
Measures Chebyshev tile distance from the local player.- Parameters:
tile- destination tile- Returns:
- tile distance, or
Integer.MAX_VALUEacross planes
-
isInArea
Tests whether the local player's tile is inside an area.- Parameters:
area- area to test- Returns:
truewhen the player is inside
-
count
Counts loaded players accepted by a predicate.- Parameters:
filter- predicate applied to each player- Returns:
- number of matching players
-
exists
Tests whether any loaded player matches a predicate.- Parameters:
filter- predicate applied to each player- Returns:
truewhen a match exists
-