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 Summary
Modifier and TypeMethodDescriptionvoidAdds a player to the online cache.voidClears all cachesget(int id) Gets a player by database ID with caching.Gets a player by name with caching.get(@NonNull InetAddress inetAddress) Gets a player by IP address with caching.Gets a player by UUID with caching.Gets all players from the database.getFromCache(@Nullable UUID uuid) Reads a player from the cache only.getFromDatabase(UUID uuid) Reads a player straight from the database, bypassing the cache.Gets all online players plus the console.Gets all online players from the cache.Gets all online players from the database.getPlayersByIp(@NonNull String ip) Gets the list of players with the specified IP address.voidInvalidates a player from all caches.voidremoveOffline(@NonNull UUID uuid) Removes a player from the offline cache.voidremoveOnline(@NonNull UUID uuid) Moves a player from online to offline cache.voidremoveOnline(@NonNull FPlayer fPlayer) Moves a player from online to offline cache.voidsaveOrIgnore(@NonNull FPlayer fPlayer) Saves a player or ignores if already exists.saveOrUpdate(@NonNull UUID uuid, @NonNull String name, @Nullable String ip, boolean online) Saves or updates a player in the database.voidsetOfflineByServer(@NonNull String server) Sets all players associated with the specified server to offline status.voidUpdates a player in the database.voidupdateCache(FPlayer fPlayer) Updates the cache with the latest player data
-
Method Details
-
invalid
Invalidates a player from all caches.- Parameters:
uuid- the player UUID to invalidate
-
get
Gets a player by database ID with caching.- Parameters:
id- the player database ID- Returns:
- the player
-
get
Gets a player by IP address with caching.- Parameters:
inetAddress- the IP address- Returns:
- the player
-
get
-
get
-
getFromDatabase
-
getFromCache
-
removeOffline
Removes a player from the offline cache.- Parameters:
uuid- the player UUID
-
removeOnline
Moves a player from online to offline cache.- Parameters:
uuid- the player UUID
-
removeOnline
Moves a player from online to offline cache.- Parameters:
fPlayer- the player
-
add
Adds a player to the online cache.- Parameters:
fPlayer- the player to add
-
updateCache
Updates the cache with the latest player data- Parameters:
fPlayer- the player data to update in cache
-
clearCache
void clearCache()Clears all caches -
saveOrUpdate
Saves or updates a player in the database.- Parameters:
uuid- the player's UUIDname- the player's nameip- the player's IP address, can be nullonline- whether the player is currently online- Returns:
- the created or updated FPlayer object with assigned database ID
-
update
Updates a player in the database.- Parameters:
fPlayer- the player to update
-
setOfflineByServer
Sets all players associated with the specified server to offline status.- Parameters:
server- the server identifier to match against player server settings
-
saveOrIgnore
Saves a player or ignores if already exists.- Parameters:
fPlayer- the player to save
-
getPlayersByIp
-
getAllPlayersDatabase
-
getOnlinePlayersDatabase
-
getOnlinePlayers
-
getOnlineFPlayersWithConsole
-