Interface FPlayerRepository


public interface FPlayerRepository
Repository for managing player data in FlectonePulse. Provides caching and retrieval of player information from various sources.
Since:
0.8.1
  • Method Details

    • invalid

      void invalid(@NonNull UUID uuid)
      Invalidates a player from all caches.
      Parameters:
      uuid - the player UUID to invalidate
    • get

      FPlayer get(int id)
      Gets a player by database ID with caching.
      Parameters:
      id - the player database ID
      Returns:
      the player
    • get

      FPlayer get(@NonNull InetAddress inetAddress)
      Gets a player by IP address with caching.
      Parameters:
      inetAddress - the IP address
      Returns:
      the player
    • get

      FPlayer get(@NonNull UUID uuid)
      Gets a player by UUID with caching.
      Parameters:
      uuid - the player UUID
      Returns:
      the player
    • get

      FPlayer get(@NonNull String playerName)
      Gets a player by name with caching.
      Parameters:
      playerName - the player name
      Returns:
      the player
    • getFromDatabase

      FPlayer getFromDatabase(UUID uuid)
      Reads a player straight from the database, bypassing the cache.
      Parameters:
      uuid - the account id
      Returns:
      the player, or the unknown player if there is no row
    • getFromCache

      FPlayer getFromCache(@Nullable UUID uuid)
      Reads a player from the cache only.
      Parameters:
      uuid - the account id, may be null
      Returns:
      the player, or the unknown player if they are not cached
    • removeOffline

      void removeOffline(@NonNull UUID uuid)
      Removes a player from the offline cache.
      Parameters:
      uuid - the player UUID
    • removeOnline

      void removeOnline(@NonNull UUID uuid)
      Moves a player from online to offline cache.
      Parameters:
      uuid - the player UUID
    • removeOnline

      void removeOnline(@NonNull FPlayer fPlayer)
      Moves a player from online to offline cache.
      Parameters:
      fPlayer - the player
    • add

      void add(@NonNull FPlayer fPlayer)
      Adds a player to the online cache.
      Parameters:
      fPlayer - the player to add
    • updateCache

      void updateCache(FPlayer fPlayer)
      Updates the cache with the latest player data
      Parameters:
      fPlayer - the player data to update in cache
    • clearCache

      void clearCache()
      Clears all caches
    • saveOrUpdate

      FPlayer saveOrUpdate(@NonNull UUID uuid, @NonNull String name, @Nullable String ip, boolean online)
      Saves or updates a player in the database.
      Parameters:
      uuid - the player's UUID
      name - the player's name
      ip - the player's IP address, can be null
      online - whether the player is currently online
      Returns:
      the created or updated FPlayer object with assigned database ID
    • update

      void update(@NonNull FPlayer fPlayer)
      Updates a player in the database.
      Parameters:
      fPlayer - the player to update
    • setOfflineByServer

      void setOfflineByServer(@NonNull String server)
      Sets all players associated with the specified server to offline status.
      Parameters:
      server - the server identifier to match against player server settings
    • saveOrIgnore

      void saveOrIgnore(@NonNull FPlayer fPlayer)
      Saves a player or ignores if already exists.
      Parameters:
      fPlayer - the player to save
    • getPlayersByIp

      List<FPlayer> getPlayersByIp(@NonNull String ip)
      Gets the list of players with the specified IP address.
      Parameters:
      ip - the IP address to filter players by
      Returns:
      list of players matching the IP, ordered by ID descending
    • getAllPlayersDatabase

      List<FPlayer> getAllPlayersDatabase()
      Gets all players from the database.
      Returns:
      list of all players
    • getOnlinePlayersDatabase

      List<FPlayer> getOnlinePlayersDatabase()
      Gets all online players from the database.
      Returns:
      list of online players
    • getOnlinePlayers

      List<FPlayer> getOnlinePlayers()
      Gets all online players from the cache.
      Returns:
      list of online players
    • getOnlineFPlayersWithConsole

      List<FPlayer> getOnlineFPlayersWithConsole()
      Gets all online players plus the console.
      Returns:
      list of online players and console