Repository navigation
Supporter System
Citrine provides a remotely updated supporter system that allows mods to maintain lists of supporter UUIDs. Lists are fetched from HTTPS endpoints, cached locally, and periodically refreshed.
The system uses UUIDs rather than usernames, so supporter status is not tied to a player's Minecraft name.
org.carpentry.citrine.api.supporterorg.carpentry.citrine.api.util
Use SupporterUtils.createRemoteList() to create and register a remotely updated supporter list.
public static final SupporterList SUPPORTERS =
SupporterUtils.createRemoteList(
"examplemod",
URI.create("https://example.com/supporters.json"),
Duration.ofMinutes(30)
);Parameters:
| Parameter | Description |
|---|---|
id |
Unique identifier for the list. |
uri |
HTTPS URL pointing to the supporter JSON file. |
refreshInterval |
How frequently the list should be refreshed. |
The list ID may only contain letters, numbers, underscores, and hyphens. Refresh intervals must be at least one minute.
Each registered list is automatically refreshed, beginning immediately after registration.
SupporterList represents a remotely maintained collection of supporter UUIDs.
boolean supporter = SUPPORTERS.isSupporter(player.getUuid());Returns whether the supplied UUID belongs to the list.
Set<UUID> supporters = SUPPORTERS.getSupporters();Returns an immutable snapshot of the current supporter UUIDs.
SUPPORTERS.refresh();Requests an immediate refresh and returns a CompletableFuture<Boolean> indicating whether the refresh succeeded.
A failed refresh preserves the last successfully loaded supporter list.
Supporter lists must use the following JSON structure:
{
"version": 1,
"supporters": [
"00000000-0000-0000-0000-000000000000",
"11111111-1111-1111-1111-111111111111"
]
}-
versionspecifies the format version. Currently, only version1is supported. -
supporterscontains the UUID strings of registered supporters.
Invalid entries or unsupported formats cause the refresh to fail.
Supporter lists are cached in the following directory:
.minecraft/config/citrine/supporters/
Each list gets its own JSON file, named after its registered ID.
Cached supporter data is loaded when the list is constructed, allowing previously fetched supporter information to remain available while offline or when a refresh fails.
SupporterUtils.getStyledName() provides a convenient way to append Citrine's supporter indicator to a player's name.
Text name = SupporterUtils.getStyledName(
player.getUuid(),
player.getName()
);If the player belongs to Citrine.CITRINE_SUPPORTERS, an orange supporter glyph is appended to the supplied text. Otherwise, the original text is returned unchanged.
The supporter glyph uses the private-use character U+E782 and requires a font resource that defines it.
Call SupporterUtils.shutdown() during mod/server shutdown:
SupporterUtils.shutdown();This cancels scheduled refresh tasks, clears registered lists, and shuts down the refresh executor.
Important: The refresh manager cannot be reused after shutdown. Call this only when the application is actually shutting down.