Package nl.minetopiasdb.api.playerdata
Class PlayerManager
java.lang.Object
nl.minetopiasdb.api.playerdata.PlayerManager
Class for managing playerdata.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDefaults
(UUID uuid) Add default userdata for given UUID.void
Clear the offline player cacheGet a list with all the UUIDs that have playerdata changesstatic PlayerManager
Get the instance of PlayerManager.static OfflineSDBPlayer
getOfflinePlayer
(UUID uuid) Get an OfflineSDBPlayer instance for the requested player.static OnlineSDBPlayer
getOnlinePlayer
(UUID uuid) Get an OnlineSDBPlayer instance for the requested player.Get all the currently online SDBPlayersstatic SDBPlayer
Get a SDBPlayer instance for the requested player.boolean
isInDatabase
(UUID uuid) Check if given UUID is in the playerdata database.boolean
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.)boolean
isOfflineCached
(UUID uuid) Check if the given player is in the offline SDBPlayer cache.void
loadPlayer
(UUID uuid) Load playerdata from the database and put it in the cache.void
Add all the playerdata changes of provided UUID to the database.void
pushSetsToDatabase
(UUID uuid) Push all the changes to this UUID to the database.void
Remove a player from the OnlineSDBPlayer cachevoid
removeFromChangeCache
(UUID uuid) Remove a player from the changes cache.void
removeFromOfflineCache
(UUID uuid) Remove a player from the offline SDBPlayer cache.void
setLoading
(UUID uuid) Set the player as 'loading'.void
stopLoading
(UUID uuid) Removes the player from the 'loading' list which can be checked with the isLoading() methodvoid
Swap 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
Get a SDBPlayer instance for the requested player. Will return aSDBPlayer
for an online or offline player.- Parameters:
uuid
- UUID of the player- Returns:
- SDBPlayer instance for given UUID
-
getOnlinePlayer
Get an OnlineSDBPlayer instance for the requested player. Will return aOnlineSDBPlayer
for 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 aOfflineSDBPlayer
for 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
Get a list with all the UUIDs that have playerdata changes- Returns:
- list with UUIDs that have playerdata changes
-
manageSet
Add all the playerdata changes of provided UUID to the database.- Parameters:
who
- UUID of the playerpath
- path of the changed playerdatavalue
- new value of playerdata
-
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
Swap data from Player 1 to Player 2- Parameters:
source
- source playertarget
- target player
-