Class DataSystem

java.lang.Object
me.fami6xx.rpuniverse.core.DataSystem
All Implemented Interfaces:
org.bukkit.event.Listener

public class DataSystem extends Object implements org.bukkit.event.Listener
The DataSystem is the main class for handling the data. It is responsible for loading the player data, saving the player data, and handling the data handler.

The DataSystem is a singleton class, so only one instance of it should be created.

The DataSystem is also a listener for the PlayerJoinEvent and PlayerQuitEvent. This means that the DataSystem will also listen for these events and update the player data accordingly.

  • Constructor Details

    • DataSystem

      public DataSystem()
      Constructor for the DataSystem. Initializes the data handler, player data map, save queue, and last access time map. Also starts the data handler and schedules the save tasks and expiration task.
  • Method Details

    • onPlayerJoin

      public void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event)
    • onPlayerQuit

      public void onPlayerQuit(org.bukkit.event.player.PlayerQuitEvent event)
    • shutdown

      public void shutdown()
      Shuts down the data system. Cancels the save tasks, saves all player data, and shuts down the data handler.
    • getDataHandler

      public IDataHandler getDataHandler()
      Gets the data handler.
      Returns:
      The data handler.
    • getPlayerData

      public PlayerData getPlayerData(UUID uuid)
      Gets the player data for the specified UUID.
      Parameters:
      uuid - The UUID of the player to get the data for.
      Returns:
      The player data for the specified UUID. Null if not found.
    • getPlayerData

      public PlayerData getPlayerData(String UUID)
      Retrieves the player data for the specified UUID.
      Parameters:
      UUID - The UUID of the player to get the data for.
      Returns:
      The player data for the specified UUID. Null if not found.
    • queuePlayerDataForSaving

      public void queuePlayerDataForSaving(PlayerData data)
      Queues the player data for saving.
      Parameters:
      data - The player data to save.
    • saveAllData

      public void saveAllData()
      Saves all data.