Klasse ConfirmationService
java.lang.Object
de.delinkedde.areashopreborn.application.ConfirmationService
Holds short-lived confirmations for destructive or ownership-changing player actions.
Confirmations intentionally live in memory: a restart cancels them instead of unexpectedly executing an old action. Each player may have at most one pending confirmation.
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungConfirmationService(Duration timeout) Creates a confirmation store.ConfirmationService(Duration timeout, int maximumPending) Creates a bounded confirmation store. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungbooleanCancels a player's pending action.Consumes and executes a pending action.request(UUID playerId, String description, Supplier<CompletableFuture<ConfirmationResult>> action) Replaces a player's pending action and returns its new confirmation token.
-
Konstruktordetails
-
ConfirmationService
Creates a confirmation store.- Parameter:
timeout- maximum confirmation lifetime
-
ConfirmationService
Creates a bounded confirmation store.- Parameter:
timeout- maximum confirmation lifetimemaximumPending- maximum distinct players retained at once
-
-
Methodendetails
-
request
public String request(UUID playerId, String description, Supplier<CompletableFuture<ConfirmationResult>> action) Replaces a player's pending action and returns its new confirmation token.- Parameter:
playerId- player requesting the actiondescription- human-readable action descriptionaction- deferred operation executed only after confirmation- Gibt zurück:
- generated case-insensitive token
-
confirm
Consumes and executes a pending action.- Parameter:
playerId- confirming playersuppliedToken- optional token; required to match when provided- Gibt zurück:
- future containing the action's success message
-
cancel
Cancels a player's pending action.- Parameter:
playerId- player identifier- Gibt zurück:
truewhen an action was removed
-