Interface IPlayers
- All Superinterfaces:
EntityProvider<IPlayer>,SceneEntityProvider<IPlayer>
This interface extends SceneEntityProvider to provide player-specific querying
capabilities, including methods to retrieve the local player, players by index, or
the hint-arrowed player.
The provider maintains a cache of all visible players in the current world view, which is updated each game tick. This includes both the local player and all other players within the visible scene.
Example usage:
IPlayers players = Static.getPlayers();
// Get the local player
IPlayer me = players.getLocal();
// Get all players in the scene
List<IPlayer> allPlayers = players.getAll(p -> true);
// Find a specific player by name
IPlayer target = players.getNearest("PlayerName");
// Get the hint-arrowed player
IPlayer hinted = players.getHintArrowed();
- See Also:
-
Method Summary
Methods inherited from interface net.storm.api.entities.SceneEntityProvider
getAll, getAll, getAll, getNearest, getNearest, getNearest, getNearest, getNearest, getNearest
-
Method Details
-
get
Gets a player by their server-assigned index (player ID).Each player in the game has a unique index assigned by the server for the current session. This method retrieves the cached player wrapper for the given index.
- Parameters:
index- the server-assigned player index- Returns:
- the player at the given index, or null if no player exists at that index
-
getLocal
IPlayer getLocal()Gets the local player (the player controlled by this client).This is a convenience method to quickly access the player character that the current client is controlling. The local player is always available when logged into the game.
- Returns:
- the local player, or null if not logged in
-
getHintArrowed
IPlayer getHintArrowed()Gets the player that currently has the hint arrow pointing to them.The hint arrow is typically used by the game to indicate players that are relevant to the current activity, such as in minigames or certain quest scenarios.
- Returns:
- the hint-arrowed player, or null if no player has a hint arrow
-