public class DataCacheHandler extends LocationCache
Constructor and Description |
---|
DataCacheHandler(Plan plugin)
Class Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addToPool(HandlingInfo i)
Used to add event HandlingInfo to the processTask's pool.
|
void |
cache(UserData data)
Used to Cache a UserData object to the Cache.
|
void |
clearCache()
Schedules all UserData from the Cache to be cleared.
|
void |
clearFromCache(UUID uuid)
Clears the matching UserData from the Cache if they're not online.
|
Map<String,Integer> |
getCommandUse()
Used to get the cached commandUse.
|
boolean |
getCommandUseFromDb()
Used to get the initial commandUse Map from the database.
|
HashMap<UUID,UserData> |
getDataCache()
Used to get the contents of the cache.
|
int |
getMaxPlayers()
Used by Analysis for Player activity graphs.
|
void |
getUserDataForProcessing(DBCallableProcessor processor,
UUID uuid)
Uses Database or Cache to retrieve the UserData of a matching player.
|
void |
getUserDataForProcessing(DBCallableProcessor processor,
UUID uuid,
boolean cache)
Uses Database or Cache to retrieve the UserData of a matching player.
|
void |
handleCommand(String command)
Used to handle a command's execution.
|
void |
handleReload()
If /reload is run this treats every online player as a new login.
|
boolean |
isDataAccessed(UUID uuid)
Check whether or not the UserData object is being accessed by save or
process tasks.
|
void |
newPlayer(org.bukkit.OfflinePlayer player)
Creates a new UserData instance and saves it to the Database.
|
void |
newPlayer(org.bukkit.entity.Player player)
Creates a new UserData instance and saves it to the Database.
|
void |
newPlayer(UserData data)
Schedules a new player's data to be saved to the Database.
|
void |
saveCachedData(UUID uuid)
Saves the cached data of matching Player if it is in the cache.
|
void |
saveCachedUserData()
Saves all UserData in the cache to Database.
|
void |
saveCacheOnDisable()
Saves all data in the cache to Database and closes the database down.
|
void |
saveCommandUse()
Saves the cached CommandUse.
|
void |
saveHandlerDataToCache()
Refreshes the calculations for all online players with ReloadInfo.
|
void |
scheludeForClear(UUID uuid)
Schedules a matching UserData object to be cleared from the cache.
|
void |
startAsyncPeriodicSaveTask()
Used to start the Asyncronous Save Task.
|
void |
startQueues()
Used to start all processing Queue Threads.
|
addLocation, addLocations, clearLocations, getLocationsForSaving
addSession, endSession, getActiveSessions, getSession, startSession
public DataCacheHandler(Plan plugin)
plugin
- Current instance of Planpublic boolean getCommandUseFromDb()
public void startQueues()
public void startAsyncPeriodicSaveTask() throws IllegalArgumentException, IllegalStateException
IllegalArgumentException
- BukkitRunnable was given wrong
parameters.IllegalStateException
- BukkitScheduler is in a wrong state.public void getUserDataForProcessing(DBCallableProcessor processor, UUID uuid, boolean cache)
processor
- DBCallableProcessor Object used to process the data
after it was retrieveduuid
- Player's UUIDcache
- Whether or not the UserData will be Cached in this instance
of DataCacheHandler after it has been fetched (if not already fetched)public void cache(UserData data)
data
- UserData object with the UUID inside used as key.public void getUserDataForProcessing(DBCallableProcessor processor, UUID uuid)
processor
- DBCallableProcessor Object used to process the data
after it was retrieveduuid
- Player's UUIDpublic void saveCachedUserData()
public void addToPool(HandlingInfo i)
i
- Object that extends HandlingInfo.public void saveCacheOnDisable()
public void saveCachedData(UUID uuid)
uuid
- Player's UUIDpublic void saveCommandUse()
public void saveHandlerDataToCache()
public void clearCache()
public void clearFromCache(UUID uuid)
uuid
- Player's UUIDpublic void scheludeForClear(UUID uuid)
uuid
- Player's UUID.public boolean isDataAccessed(UUID uuid)
uuid
- Player's UUIDpublic void newPlayer(org.bukkit.entity.Player player)
player
- Player the new UserData is created forpublic void newPlayer(org.bukkit.OfflinePlayer player)
player
- Player the new UserData is created forpublic void newPlayer(UserData data)
data
- UserData object to schedule for save.public HashMap<UUID,UserData> getDataCache()
public Map<String,Integer> getCommandUse()
public void handleReload()
public int getMaxPlayers()
public void handleCommand(String command)
command
- "/command"Copyright © 2017. All rights reserved.