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 Summary
Modifier and TypeMethodDescriptionCompletableFuture<Optional<com.google.gson.JsonElement>> Gets a raw JSON value.<T> CompletableFuture<Optional<T>> Gets and maps a JSON value to a Java type.getBoolean(String key, boolean fallback) Gets a boolean value.Gets a long value.Gets a string value.Removes a stored value.Stores a raw JSON value.Stores a Java value as JSON.
-
Method Details
-
get
Gets a raw JSON value.- Parameters:
key- data key- Returns:
- future containing the stored JSON value, if present
-
get
Gets and maps a JSON value to a Java type.- Type Parameters:
T- target type- Parameters:
key- data keytype- target type- Returns:
- future containing the mapped value, or an empty result if the value is absent or has a different type
-
getString
Gets a string value.- Parameters:
key- data keyfallback- value returned when the key is absent or incompatible- Returns:
- future containing the stored string or fallback
-
getLong
Gets a long value.- Parameters:
key- data keyfallback- value returned when the key is absent or incompatible- Returns:
- future containing the stored long or fallback
-
getBoolean
Gets a boolean value.- Parameters:
key- data keyfallback- value returned when the key is absent or incompatible- Returns:
- future containing the stored boolean or fallback
-
set
Stores a raw JSON value.- Parameters:
key- data keyvalue- JSON value to store- Returns:
- completion future
-
set
Stores a Java value as JSON.- Parameters:
key- data keyvalue- value to convert to JSON and store- Returns:
- completion future
-
remove
Removes a stored value.- Parameters:
key- data key- Returns:
- completion future
-