Interface PlayerDataStorage


public interface PlayerDataStorage
Persistence backend for the game mode, respawn point and last position of players.

The server registers a default implementation as a service; plugins may replace it, for instance to store players in a database.

Since:
0.1.0
  • Method Details

    • load

      Loads the data of a player.
      Parameters:
      uuid - the player identity
      defaults - the values to return when nothing was saved
      Returns:
      the saved data, or defaults
      Throws:
      IOException - if the data cannot be read
      Since:
      0.1.0
    • save

      void save(UUID uuid, PlayerDataStorage.PlayerData data) throws IOException
      Saves the data of a player.
      Parameters:
      uuid - the player identity
      data - the data to save
      Throws:
      IOException - if the data cannot be written
      Since:
      0.1.0
    • exists

      default boolean exists(UUID uuid) throws IOException
      Checks whether saved data exists for an identity, without loading it.
      Parameters:
      uuid - the player identity
      Returns:
      true if data has been saved for that identity
      Throws:
      IOException - if the check fails
      Since:
      0.1.0