Interface PlaytimeRepository


public interface PlaytimeRepository
Repository for managing player playtime statistics and session tracking in FlectonePulse. Handles saving join/quit sessions and retrieving playtime data with caching support using Guava Cache.
Since:
1.10.1
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    getAllPlayTimes(int limit, int offset)
    Gets a paginated list of all playtime records from the database.
    @Nullable PlayTime
    Gets the playtime statistics for a specific player with cache support.
    int
    Gets the total count of all playtime records in the database.
    void
    Invalidates cached playtime statistics for a player.
    void
    saveAfkSession(FPlayer fPlayer, boolean afk)
    Saves a player's AFK session status change.
    void
    Saves a player's join session when they connect to the server.
    void
    Saves a playtime session directly.
    void
    Saves a player's last seen timestamp when they disconnect from the server.
  • Method Details

    • saveJoinSession

      void saveJoinSession(FPlayer fPlayer)
      Saves a player's join session when they connect to the server.
      Parameters:
      fPlayer - the player whose join session is being saved
    • saveJoinSession

      void saveJoinSession(PlayTime playTime)
      Saves a playtime session directly.
      Parameters:
      playTime - the playtime session to save
    • saveAfkSession

      void saveAfkSession(FPlayer fPlayer, boolean afk)
      Saves a player's AFK session status change.
      Parameters:
      fPlayer - the player whose AFK status is being updated
      afk - true if the player is going AFK, false if returning from AFK
    • saveLastSeen

      void saveLastSeen(FPlayer fPlayer)
      Saves a player's last seen timestamp when they disconnect from the server.
      Parameters:
      fPlayer - the player whose last seen time is being recorded
    • getPlayTime

      @Nullable PlayTime getPlayTime(FPlayer fPlayer)
      Gets the playtime statistics for a specific player with cache support. Returns cached playtime if available, otherwise loads from database and caches the result.
      Parameters:
      fPlayer - the player to get playtime statistics for
      Returns:
      the player's playtime statistics, or null if not found
    • getPlayTimesCount

      int getPlayTimesCount()
      Gets the total count of all playtime records in the database.
      Returns:
      the total number of playtime records
    • getAllPlayTimes

      List<PlayTime> getAllPlayTimes(int limit, int offset)
      Gets a paginated list of all playtime records from the database.
      Parameters:
      limit - the maximum number of records to retrieve
      offset - the number of records to skip before returning results
      Returns:
      list of playtime records within the specified range
    • invalidate

      void invalidate(UUID uuid)
      Invalidates cached playtime statistics for a player.
      Parameters:
      uuid - the UUID of the player whose playtime cache should be cleared