Class PlayerManager
java.lang.Object
nl.minetopiasdb.api.playerdata.PlayerManager
Class for managing playerdata.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDefaults(UUID uuid) Add default userdata for given UUID.voidClear the offline player cacheGet a list with all the UUIDs that have playerdata changesstatic PlayerManagerGet the instance of PlayerManager.static OfflineSDBPlayergetOfflinePlayer(UUID uuid) Get an OfflineSDBPlayer instance for the requested player.static OnlineSDBPlayergetOnlinePlayer(UUID uuid) Get an OnlineSDBPlayer instance for the requested player.Get all the currently online SDBPlayersstatic SDBPlayerGet a SDBPlayer instance for the requested player.booleanisInDatabase(UUID uuid) Check if given UUID is in the playerdata database.booleanCheck if a player his data is still loading (if he just joined there is a slight delay between the join and his data being fully loaded.)booleanisOfflineCached(UUID uuid) Check if the given player is in the offline SDBPlayer cache.voidloadPlayer(UUID uuid) Load playerdata from the database and put it in the cache.voidAdd all the playerdata changes of provided UUID to the database.voidpushSetsToDatabase(UUID uuid) Push all the changes to this UUID to the database.voidRemove a player from the OnlineSDBPlayer cachevoidremoveFromChangeCache(UUID uuid) Remove a player from the changes cache.voidremoveFromOfflineCache(UUID uuid) Remove a player from the offline SDBPlayer cache.voidsetLoading(UUID uuid) Set the player as 'loading'.voidstopLoading(UUID uuid) Removes the player from the 'loading' list which can be checked with the isLoading() methodvoidSwap data from Player 1 to Player 2
-
Constructor Details
-
PlayerManager
public PlayerManager()
-
-
Method Details
-
getInstance
Get the instance of PlayerManager.- Returns:
- instance of PlayerManager.
-
getOnlinePlayers
Get all the currently online SDBPlayers- Returns:
- Collection of the online SDBPlayers.
-
getPlayer
-
getOnlinePlayer
Get an OnlineSDBPlayer instance for the requested player. Will return aOnlineSDBPlayerfor an online player.- Parameters:
uuid- UUID of the online player- Returns:
- OnlineSDBPlayer instance for given UUID
-
getOfflinePlayer
Get an OfflineSDBPlayer instance for the requested player. Will return aOfflineSDBPlayerfor an offline player.- Parameters:
uuid- UUID of the offline player- Returns:
- OfflineSDBPlayer instance for given UUID
-
isInDatabase
Check if given UUID is in the playerdata database.- Parameters:
uuid- UUID that needs to be checked.- Returns:
- true if UUID is found in the database.
-
addDefaults
Add default userdata for given UUID.- Parameters:
uuid- uuid that needs userdata.
-
loadPlayer
Load playerdata from the database and put it in the cache.- Parameters:
uuid- UUID of player
-
quit
Remove a player from the OnlineSDBPlayer cache- Parameters:
uuid- UUID of player that needs to be removed
-
getChangedUsers
-
manageSet
-
pushSetsToDatabase
Push all the changes to this UUID to the database.- Parameters:
uuid- UUID of player
-
isLoading
Check if a player his data is still loading (if he just joined there is a slight delay between the join and his data being fully loaded.)- Parameters:
uuid- player who needs to be checked- Returns:
- true if his data is currently loaded
-
setLoading
Set the player as 'loading'.- Parameters:
uuid- player who needs to be set as loading.
-
stopLoading
Removes the player from the 'loading' list which can be checked with the isLoading() method- Parameters:
uuid- player who needs to be removed from the loading list.
-
isOfflineCached
Check if the given player is in the offline SDBPlayer cache.- Parameters:
uuid- player who needs to be checked- Returns:
- true if given player is in offline SDBPlayer cache.
-
removeFromOfflineCache
Remove a player from the offline SDBPlayer cache.- Parameters:
uuid- player who needs to be removed from the offline SDBPlayer cache.
-
clearOfflineCache
public void clearOfflineCache()Clear the offline player cache -
removeFromChangeCache
Remove a player from the changes cache.- Parameters:
uuid- uuid of player
-
swap
-