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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordThe persisted state of a player. -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanChecks whether saved data exists for an identity, without loading it.load(UUID uuid, PlayerDataStorage.PlayerData defaults) Loads the data of a player.voidsave(UUID uuid, PlayerDataStorage.PlayerData data) Saves the data of a player.
-
Method Details
-
load
PlayerDataStorage.PlayerData load(UUID uuid, PlayerDataStorage.PlayerData defaults) throws IOException Loads the data of a player.- Parameters:
uuid- the player identitydefaults- 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
Saves the data of a player.- Parameters:
uuid- the player identitydata- the data to save- Throws:
IOException- if the data cannot be written- Since:
- 0.1.0
-
exists
Checks whether saved data exists for an identity, without loading it.- Parameters:
uuid- the player identity- Returns:
trueif data has been saved for that identity- Throws:
IOException- if the check fails- Since:
- 0.1.0
-