Interface ProfileDataSource
@Contract
public sealed interface ProfileDataSource
A source for updating and retrieving player profiles via persistence.
-
Method Summary
Modifier and TypeMethodDescriptiondeleteGlobalProfile
(GlobalProfileKey key, boolean clearPlayerFiles) Deletes the file for a player's global profile from disk.deletePlayerFile
(ProfileFileKey profileKey) Deletes the profile file for a player's profile from disk.deletePlayerProfile
(ProfileKey profileKey) Clears all data of the specified profile, and deletes profile data from disk.deletePlayerProfiles
(ProfileFileKey profileKey, ProfileType[] profileTypes) Clears all data for multipleProfileType
of the specified profile, and deletes profile data from disk.CompletableFuture
<org.mvplugins.multiverse.external.vavr.control.Option<GlobalProfile>> Retrieves the global profile for a player which contains meta-data for the player if it exists.Retrieves the global profile for a player which contains meta-data for the player.getPlayerProfile
(ProfileKey profileKey) Retrieves a PlayerProfile from the disk.listContainerDataNames
(ContainerType containerType) Lists the names of all available data containers of the specified type.Retrieves a collection of UUIDs of all players who have a global profile.listPlayerProfileNames
(ContainerType containerType, String containerName) Lists the names of all available player profiles within the given container type and container name.void
migratePlayerProfileName
(String oldName, String newName) Copies all the data belonging to oldName to newName and removes the old data.modifyGlobalProfile
(GlobalProfileKey key, Consumer<GlobalProfile> consumer) Modifies the global profile for a player and automatically saves it.updateGlobalProfile
(GlobalProfile globalProfile) Update the file for a player's global profile to disk.updatePlayerProfile
(PlayerProfile playerProfile) Updates the persisted data for a player for a specific profile to disk.
-
Method Details
-
getPlayerProfile
Retrieves a PlayerProfile from the disk. If no data was found, a new PlayerProfile will be created.- Parameters:
profileKey
- The key of the profile to retrieve.- Returns:
- The player profile data.
-
updatePlayerProfile
Updates the persisted data for a player for a specific profile to disk.- Parameters:
playerProfile
- The profile for the player that is being updated.- Returns:
- Future that completes when the profile has been updated.
-
deletePlayerProfile
Clears all data of the specified profile, and deletes profile data from disk.
This action is irreversible.- Parameters:
profileKey
- The key of the profile to delete- Returns:
- Future that completes when the profile has been deleted.
-
deletePlayerProfiles
Clears all data for multipleProfileType
of the specified profile, and deletes profile data from disk. If all profiles are deleted, the profile file itself will be deleted.
This action is irreversible.- Parameters:
profileKey
- The key of the profile to deleteprofileTypes
- The list of profile types to delete- Returns:
- Future that completes when the profile has been deleted.
-
deletePlayerFile
Deletes the profile file for a player's profile from disk. Essentially same asdeletePlayerProfiles(ProfileFileKey, ProfileType[])
with all profile types.
This action is irreversible.- Parameters:
profileKey
- The key of the profile to delete- Returns:
- Future that completes when the profile has been deleted.
-
migratePlayerProfileName
Copies all the data belonging to oldName to newName and removes the old data.- Parameters:
oldName
- the previous name of the player.newName
- the new name of the player.- Throws:
IOException
- Thrown if something goes wrong while migrating the files.
-
getGlobalProfile
Retrieves the global profile for a player which contains meta-data for the player.- Parameters:
key
- The key of the player.- Returns:
- The global profile for the specified player asynchronously.
-
getExistingGlobalProfile
CompletableFuture<org.mvplugins.multiverse.external.vavr.control.Option<GlobalProfile>> getExistingGlobalProfile(GlobalProfileKey key) Retrieves the global profile for a player which contains meta-data for the player if it exists.- Parameters:
key
- The key of the player.- Returns:
- The global profile for the specified player or
Option.none()
if it does not exist asynchronously.
-
modifyGlobalProfile
Modifies the global profile for a player and automatically saves it.- Parameters:
key
- The key of the player.- Returns:
- A CompletableFuture that completes when the global profile has been saved.
-
updateGlobalProfile
Update the file for a player's global profile to disk.- Parameters:
globalProfile
- The GlobalProfile object to update the file for.- Returns:
- A CompletableFuture that completes when the global profile has been updated.
-
deleteGlobalProfile
Deletes the file for a player's global profile from disk. Optionally clears the player's profile data files as well.- Parameters:
key
- The key of the player.clearPlayerFiles
- Whether to clear the player's profile data files as well.- Returns:
- A CompletableFuture that completes when the global profile has been deleted.
-
listContainerDataNames
Lists the names of all available data containers of the specified type.- Parameters:
containerType
- The type of the container (e.g., WORLD, GROUP) whose data names are to be listed.- Returns:
- A collection of strings representing the names of the data containers.
-
listPlayerProfileNames
Lists the names of all available player profiles within the given container type and container name.- Parameters:
containerType
- The type of the container (e.g., WORLD, GROUP) whose player profiles are to be listed.containerName
- The name of the container whose player profiles are to be listed.- Returns:
- A collection of strings representing the names of all available player profiles.
-
listGlobalProfileUUIDs
Retrieves a collection of UUIDs of all players who have a global profile.- Returns:
- A collection of UUIDs of all players who have a global profile.
-