Class StaticGameStatsSource

java.lang.Object
lol.trq.alts.spi.StaticGameStatsSource
All Implemented Interfaces:
GameStatsSource

public final class StaticGameStatsSource extends Object implements GameStatsSource
A trivial GameStatsSource backed by a fixed, in-memory map of player UUID to display chips. It is the simplest possible reference implementation and is handy for demos and tests where calling a real server API is not wanted. Any UUID not in the map yields null ("no stats").
Since:
0.3.0
  • Constructor Details

    • StaticGameStatsSource

      public StaticGameStatsSource(String serverId, Map<String, List<GameStats.Stat>> chipsByUuid)
      Creates a static source for one server.
      Parameters:
      serverId - the server id this source reports
      chipsByUuid - the chips to return per player UUID (copied defensively)
      Since:
      0.3.0
  • Method Details

    • serverId

      public String serverId()
      Returns the identifier of the server this source covers. Used as the cache key and the GameStats.serverId() stamp, and looked up by AltsRuntime.gameStats(String).
      Specified by:
      serverId in interface GameStatsSource
      Returns:
      the server id (stable, non-null)
      Since:
      0.3.0
    • fetch

      public GameStats fetch(String uuid)
      Fetches stats for one player on this source's server.
      Specified by:
      fetch in interface GameStatsSource
      Parameters:
      uuid - the dashed player UUID
      Returns:
      the player's stats, or null if unavailable
      Since:
      0.3.0