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 TypeMethodDescriptiongetAllPlayTimes(int limit, int offset) Gets a paginated list of all playtime records from the database.@Nullable PlayTimegetPlayTime(FPlayer fPlayer) Gets the playtime statistics for a specific player with cache support.intGets the total count of all playtime records in the database.voidinvalidate(UUID uuid) Invalidates cached playtime statistics for a player.voidsaveAfkSession(FPlayer fPlayer, boolean afk) Saves a player's AFK session status change.voidsaveJoinSession(FPlayer fPlayer) Saves a player's join session when they connect to the server.voidsaveJoinSession(PlayTime playTime) Saves a playtime session directly.voidsaveLastSeen(FPlayer fPlayer) Saves a player's last seen timestamp when they disconnect from the server.
-
Method Details
-
saveJoinSession
Saves a player's join session when they connect to the server.- Parameters:
fPlayer- the player whose join session is being saved
-
saveJoinSession
Saves a playtime session directly.- Parameters:
playTime- the playtime session to save
-
saveAfkSession
Saves a player's AFK session status change.- Parameters:
fPlayer- the player whose AFK status is being updatedafk- true if the player is going AFK, false if returning from AFK
-
saveLastSeen
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
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
Gets a paginated list of all playtime records from the database.- Parameters:
limit- the maximum number of records to retrieveoffset- the number of records to skip before returning results- Returns:
- list of playtime records within the specified range
-
invalidate
Invalidates cached playtime statistics for a player.- Parameters:
uuid- the UUID of the player whose playtime cache should be cleared
-