Interface IDataHandler
- All Known Implementing Classes:
JSONDataHandler
public interface IDataHandler
-
Method Summary
Modifier and TypeMethodDescriptionJob[]Retrieves all job data stored by the selected Data Handler.Lock[]Gets all the saved lock data.Called when the data handlers name is needed.getJobData(String uuid)Retrieves job data for a given name.intCalled at the start of the plugin, this is used to determine how often the save task should run.HashMap<org.bukkit.inventory.ItemStack,ConsumableItem>Loads the consumables for the BasicNeedsHandler.loadPlayerData(String uuid)Called when the user data needs to be loaded.booleanremoveJobData(String uuid)Removes the job data with the specified name.voidremoveLockData(Lock lock)Removes the lock data from the data handler.booleansaveConsumables(BasicNeedsHandler handler)Saves the consumables for the BasicNeedsHandler.booleansaveJobData(String uuid, Job data)Saves the job data for a given name.booleansaveLockData(Lock lock)Saves lockbooleansavePlayerData(PlayerData data)Called when the user data needs to be saved.booleanshutDown()Called when the plugin is disabled and the data handler is selected.booleanstartUp()Called when the plugin is enabled and the data handler is selected.
-
Method Details
-
startUp
boolean startUp()Called when the plugin is enabled and the data handler is selected.- Returns:
- true if the data handler started up successfully, false otherwise.
-
shutDown
boolean shutDown()Called when the plugin is disabled and the data handler is selected.- Returns:
- true if the data handler shut down successfully, false otherwise.
-
getHandlerName
String getHandlerName()Called when the data handlers name is needed.- Returns:
- The name of the data handler.
-
loadPlayerData
Called when the user data needs to be loaded.- Parameters:
uuid- The UUID of the player to load data for.- Returns:
- The player data for the specified UUID.
-
savePlayerData
Called when the user data needs to be saved.- Parameters:
data- The player data to save.- Returns:
- true if the data was saved successfully, false otherwise.
-
getJobData
Retrieves job data for a given name. The data is serialized and deserialized by the selected Data Handler.- Parameters:
uuid- The uuid of the job to retrieve data for.- Returns:
- The job data for the specified name.
-
saveJobData
Saves the job data for a given name. The data is serialized and deserialized by the selected Data Handler.- Parameters:
uuid- The name of the job to save data for.data- The job data to save.- Returns:
- true if the data was saved successfully, false otherwise.
-
saveConsumables
Saves the consumables for the BasicNeedsHandler. The data is serialized and deserialized by the selected Data Handler.- Parameters:
handler- The BasicNeedsHandler to save consumables for.- Returns:
- true if the data was saved successfully, false otherwise.
-
loadConsumables
HashMap<org.bukkit.inventory.ItemStack,ConsumableItem> loadConsumables()Loads the consumables for the BasicNeedsHandler. The data is serialized and deserialized by the selected Data Handler.- Returns:
- A HashMap containing all consumables.
-
getAllJobData
Job[] getAllJobData()Retrieves all job data stored by the selected Data Handler.- Returns:
- An array containing all job data.
-
removeJobData
Removes the job data with the specified name.- Parameters:
uuid- The uuid of the job to remove data for.- Returns:
- true if the data was removed successfully, false otherwise.
-
getQueueSaveTime
int getQueueSaveTime()Called at the start of the plugin, this is used to determine how often the save task should run.- Returns:
- The time in ticks between each save task run.
-
saveLockData
Saves lock- Returns:
- Status if the lock has been saved.
-
getAllLockData
Lock[] getAllLockData()Gets all the saved lock data.- Returns:
- An array of all the saved lock data.
-
removeLockData
Removes the lock data from the data handler.- Parameters:
lock- The lock to remove.
-