Interface PlayerModuleData


public interface PlayerModuleData
Stores JSON data for one player and one module.

A key must start with a lowercase letter. It can contain lowercase letters, digits, and underscores. Its maximum length is 64 characters.

  • Method Details

    • get

      CompletableFuture<Optional<com.google.gson.JsonElement>> get(String key)
      Gets a raw JSON value.
      Parameters:
      key - data key
      Returns:
      future containing the stored JSON value, if present
    • get

      <T> CompletableFuture<Optional<T>> get(String key, Class<T> type)
      Gets and maps a JSON value to a Java type.
      Type Parameters:
      T - target type
      Parameters:
      key - data key
      type - target type
      Returns:
      future containing the mapped value, or an empty result if the value is absent or has a different type
    • getString

      CompletableFuture<String> getString(String key, String fallback)
      Gets a string value.
      Parameters:
      key - data key
      fallback - value returned when the key is absent or incompatible
      Returns:
      future containing the stored string or fallback
    • getLong

      CompletableFuture<Long> getLong(String key, long fallback)
      Gets a long value.
      Parameters:
      key - data key
      fallback - value returned when the key is absent or incompatible
      Returns:
      future containing the stored long or fallback
    • getBoolean

      CompletableFuture<Boolean> getBoolean(String key, boolean fallback)
      Gets a boolean value.
      Parameters:
      key - data key
      fallback - value returned when the key is absent or incompatible
      Returns:
      future containing the stored boolean or fallback
    • set

      CompletableFuture<Void> set(String key, com.google.gson.JsonElement value)
      Stores a raw JSON value.
      Parameters:
      key - data key
      value - JSON value to store
      Returns:
      completion future
    • set

      CompletableFuture<Void> set(String key, Object value)
      Stores a Java value as JSON.
      Parameters:
      key - data key
      value - value to convert to JSON and store
      Returns:
      completion future
    • remove

      Removes a stored value.
      Parameters:
      key - data key
      Returns:
      completion future