Class PlayerConfigHolder


public class PlayerConfigHolder extends AbstractAvatarConfigHolder
  • Field Details

    • needsSync

      public volatile boolean needsSync

      true if this config should be synced to the connected server on the next attempt

      This only has an effect for the client player.

    • needsCloudSync

      public volatile boolean needsCloudSync

      true if this config should be synced to the cloud sync server on the next attempt

      This only has an effect for the client player.

    • syncStatus

      public volatile SyncStatus syncStatus
      The current sync status of this player config
      See Also:
  • Constructor Details

    • PlayerConfigHolder

      public PlayerConfigHolder(UUID uuid)
  • Method Details

    • getSyncStatus

      public SyncStatus getSyncStatus()
    • attemptCloudSync

      @Internal public void attemptCloudSync()
      API Note:
      Only use this on the client side
    • hasLocalConfig

      public boolean hasLocalConfig()
      Returns:
      true if the current player has a local config file
    • loadFromDisk

      public void loadFromDisk(boolean markForSync)
      Loads the current player's settings from a file on disk
      Parameters:
      markForSync - true if needsSync should be set to true
    • save

      public void save()
      Saves the settings stored in this AvatarConfig to the underlying Configuration, and then attempts to save to disk.
    • toJson

      public com.google.gson.JsonElement toJson()
      Returns a copy of the player's current configuration; the stored values are guaranteed to be valid for the associated ConfigKey, and does not include any unrecognized keys.
      Returns:
      A new copy of the player's saved config values
    • updateFromJson

      public void updateFromJson(com.google.gson.JsonElement serialized)
      Update player data from the provided JsonObject
      Overrides:
      updateFromJson in class AbstractAvatarConfigHolder
      Parameters:
      serialized - The JsonObject to merge with the existing config for this player
      API Note:
      This method will set the player's sync status to SyncStatus.SYNCED, as it's expected that this method is only used in such cases where this would be applicable.
    • updateFromPacket

      public void updateFromPacket(AvatarConfig config)
      Specified by:
      updateFromPacket in class AbstractAvatarConfigHolder
    • getDebugInfo

      public List<String> getDebugInfo()
      Overrides:
      getDebugInfo in class AbstractAvatarConfigHolder