Interface ProfileDataSource


@Contract public sealed interface ProfileDataSource
A source for updating and retrieving player profiles via persistence.
  • Method Details

    • getPlayerProfile

      CompletableFuture<PlayerProfile> getPlayerProfile(ProfileKey profileKey)
      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

      CompletableFuture<Void> updatePlayerProfile(PlayerProfile playerProfile)
      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

      CompletableFuture<Void> deletePlayerProfile(ProfileKey profileKey)
      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

      CompletableFuture<Void> deletePlayerProfiles(ProfileFileKey profileKey, ProfileType[] profileTypes)
      Clears all data for multiple ProfileType 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 delete
      profileTypes - The list of profile types to delete
      Returns:
      Future that completes when the profile has been deleted.
    • deletePlayerFile

      CompletableFuture<Void> deletePlayerFile(ProfileFileKey profileKey)
      Deletes the profile file for a player's profile from disk. Essentially same as deletePlayerProfiles(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

      void migratePlayerProfileName(String oldName, String newName) throws IOException
      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

      CompletableFuture<Void> modifyGlobalProfile(GlobalProfileKey key, Consumer<GlobalProfile> consumer)
      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

      CompletableFuture<Void> updateGlobalProfile(GlobalProfile globalProfile)
      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

      CompletableFuture<Void> deleteGlobalProfile(GlobalProfileKey key, boolean clearPlayerFiles)
      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

      List<String> listContainerDataNames(ContainerType containerType)
      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

      List<String> listPlayerProfileNames(ContainerType containerType, String containerName)
      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

      List<UUID> 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.