Class JSONDataHandler

java.lang.Object
me.fami6xx.rpuniverse.core.misc.datahandlers.JSONDataHandler
All Implemented Interfaces:
IDataHandler

public class JSONDataHandler extends Object implements IDataHandler
  • Constructor Details

    • JSONDataHandler

      public JSONDataHandler()
  • Method Details

    • startUp

      public boolean startUp()
      Description copied from interface: IDataHandler
      Called when the plugin is enabled and the data handler is selected.
      Specified by:
      startUp in interface IDataHandler
      Returns:
      true if the data handler started up successfully, false otherwise.
    • shutDown

      public boolean shutDown()
      Description copied from interface: IDataHandler
      Called when the plugin is disabled and the data handler is selected.
      Specified by:
      shutDown in interface IDataHandler
      Returns:
      true if the data handler shut down successfully, false otherwise.
    • getHandlerName

      public String getHandlerName()
      Description copied from interface: IDataHandler
      Called when the data handlers name is needed.
      Specified by:
      getHandlerName in interface IDataHandler
      Returns:
      The name of the data handler.
    • loadPlayerData

      public PlayerData loadPlayerData(String uuid)
      Description copied from interface: IDataHandler
      Called when the user data needs to be loaded.
      Specified by:
      loadPlayerData in interface IDataHandler
      Parameters:
      uuid - The UUID of the player to load data for.
      Returns:
      The player data for the specified UUID.
    • savePlayerData

      public boolean savePlayerData(PlayerData data)
      Description copied from interface: IDataHandler
      Called when the user data needs to be saved.
      Specified by:
      savePlayerData in interface IDataHandler
      Parameters:
      data - The player data to save.
      Returns:
      true if the data was saved successfully, false otherwise.
    • getJobData

      public Job getJobData(String uuid)
      Description copied from interface: IDataHandler
      Retrieves job data for a given name. The data is serialized and deserialized by the selected Data Handler.
      Specified by:
      getJobData in interface IDataHandler
      Parameters:
      uuid - The uuid of the job to retrieve data for.
      Returns:
      The job data for the specified name.
    • saveJobData

      public boolean saveJobData(String uuid, Job data)
      Description copied from interface: IDataHandler
      Saves the job data for a given name. The data is serialized and deserialized by the selected Data Handler.
      Specified by:
      saveJobData in interface IDataHandler
      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

      public boolean saveConsumables(BasicNeedsHandler handler)
      Saves the consumables for the BasicNeedsHandler. The data is serialized and deserialized by the selected Data Handler.
      Specified by:
      saveConsumables in interface IDataHandler
      Parameters:
      handler - The BasicNeedsHandler to save consumables for.
      Returns:
      true if the data was saved successfully, false otherwise.
    • loadConsumables

      public HashMap<org.bukkit.inventory.ItemStack,​ConsumableItem> loadConsumables()
      Loads the consumables for the BasicNeedsHandler. The data is serialized and deserialized by the selected Data Handler.
      Specified by:
      loadConsumables in interface IDataHandler
      Returns:
      A HashMap containing all consumables.
    • getAllJobData

      public Job[] getAllJobData()
      Description copied from interface: IDataHandler
      Retrieves all job data stored by the selected Data Handler.
      Specified by:
      getAllJobData in interface IDataHandler
      Returns:
      An array containing all job data.
    • removeJobData

      public boolean removeJobData(String uuid)
      Description copied from interface: IDataHandler
      Removes the job data with the specified name.
      Specified by:
      removeJobData in interface IDataHandler
      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: IDataHandler
      Called at the start of the plugin, this is used to determine how often the save task should run.
      Specified by:
      getQueueSaveTime in interface IDataHandler
      Returns:
      The time in ticks between each save task run.
    • saveLockData

      public boolean saveLockData(Lock lock)
      Description copied from interface: IDataHandler
      Saves lock
      Specified by:
      saveLockData in interface IDataHandler
      Returns:
      Status if the lock has been saved.
    • getAllLockData

      public Lock[] getAllLockData()
      Description copied from interface: IDataHandler
      Gets all the saved lock data.
      Specified by:
      getAllLockData in interface IDataHandler
      Returns:
      An array of all the saved lock data.
    • removeLockData

      public void removeLockData(Lock lock)
      Description copied from interface: IDataHandler
      Removes the lock data from the data handler.
      Specified by:
      removeLockData in interface IDataHandler
      Parameters:
      lock - The lock to remove.