Class JSONDataHandler
java.lang.Object
me.fami6xx.rpuniverse.core.misc.datahandlers.JSONDataHandler
- All Implemented Interfaces:
IDataHandler
-
Constructor Summary
Constructors -
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.
-
Constructor Details
-
JSONDataHandler
public JSONDataHandler()
-
-
Method Details
-
startUp
public boolean startUp()Description copied from interface:IDataHandlerCalled when the plugin is enabled and the data handler is selected.- Specified by:
startUpin interfaceIDataHandler- Returns:
- true if the data handler started up successfully, false otherwise.
-
shutDown
public boolean shutDown()Description copied from interface:IDataHandlerCalled when the plugin is disabled and the data handler is selected.- Specified by:
shutDownin interfaceIDataHandler- Returns:
- true if the data handler shut down successfully, false otherwise.
-
getHandlerName
Description copied from interface:IDataHandlerCalled when the data handlers name is needed.- Specified by:
getHandlerNamein interfaceIDataHandler- Returns:
- The name of the data handler.
-
loadPlayerData
Description copied from interface:IDataHandlerCalled when the user data needs to be loaded.- Specified by:
loadPlayerDatain interfaceIDataHandler- Parameters:
uuid- The UUID of the player to load data for.- Returns:
- The player data for the specified UUID.
-
savePlayerData
Description copied from interface:IDataHandlerCalled when the user data needs to be saved.- Specified by:
savePlayerDatain interfaceIDataHandler- Parameters:
data- The player data to save.- Returns:
- true if the data was saved successfully, false otherwise.
-
getJobData
Description copied from interface:IDataHandlerRetrieves job data for a given name. The data is serialized and deserialized by the selected Data Handler.- Specified by:
getJobDatain interfaceIDataHandler- Parameters:
uuid- The uuid of the job to retrieve data for.- Returns:
- The job data for the specified name.
-
saveJobData
Description copied from interface:IDataHandlerSaves the job data for a given name. The data is serialized and deserialized by the selected Data Handler.- Specified by:
saveJobDatain interfaceIDataHandler- 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.- Specified by:
saveConsumablesin interfaceIDataHandler- Parameters:
handler- The BasicNeedsHandler to save consumables for.- Returns:
- true if the data was saved successfully, false otherwise.
-
loadConsumables
Loads the consumables for the BasicNeedsHandler. The data is serialized and deserialized by the selected Data Handler.- Specified by:
loadConsumablesin interfaceIDataHandler- Returns:
- A HashMap containing all consumables.
-
getAllJobData
Description copied from interface:IDataHandlerRetrieves all job data stored by the selected Data Handler.- Specified by:
getAllJobDatain interfaceIDataHandler- Returns:
- An array containing all job data.
-
removeJobData
Description copied from interface:IDataHandlerRemoves the job data with the specified name.- Specified by:
removeJobDatain interfaceIDataHandler- Parameters:
uuid- The uuid of the job to remove data for.- Returns:
- true if the data was removed successfully, false otherwise.
-
getQueueSaveTime
public int getQueueSaveTime()Description copied from interface:IDataHandlerCalled at the start of the plugin, this is used to determine how often the save task should run.- Specified by:
getQueueSaveTimein interfaceIDataHandler- Returns:
- The time in ticks between each save task run.
-
saveLockData
Description copied from interface:IDataHandlerSaves lock- Specified by:
saveLockDatain interfaceIDataHandler- Returns:
- Status if the lock has been saved.
-
getAllLockData
Description copied from interface:IDataHandlerGets all the saved lock data.- Specified by:
getAllLockDatain interfaceIDataHandler- Returns:
- An array of all the saved lock data.
-
removeLockData
Description copied from interface:IDataHandlerRemoves the lock data from the data handler.- Specified by:
removeLockDatain interfaceIDataHandler- Parameters:
lock- The lock to remove.
-