Class CloudPlayerLinks
A player link proves that the person using the web panel is the owner of a game identity. A
module creates one for a player (in practice when the player runs /panel); the gateway
answers with a one-time URL the player opens in a browser; the gateway then reports how that web
user proved the identity. A module never sees the server credential and never talks to UltiCloud
over HTTP.
Link lifetime. A link lives playerLinkTtlSeconds = 600 seconds from issue, so
CloudPlayerLinks.LinkCreation.expiresAt() is the issue time plus 600 seconds, and it is single use. Running
/panel again for the same player cancels the previous link, which is reported as an
CloudPlayerLinks.ExpiryReason.CANCELLED expiry. A link is not extended by using it.
Expiry reasons. CloudPlayerLinks.ExpiryReason.EXPIRED means nobody completed the link before it
lapsed; CloudPlayerLinks.ExpiryReason.CANCELLED means it was replaced by a newer link or cancelled by the
plugin or the player; CloudPlayerLinks.ExpiryReason.DENIED means the web user explicitly refused the
confirmation page. The framework never synthesizes an expiry event: a link whose
CloudPlayerLinks.LinkCreation.expiresAt() has passed without any event is the module's to treat as expired.
Creation failures. CloudPlayerLinks.Failure.LINK_NOT_PERMITTED means the gateway refused to issue
a link because the server is suspended, the owner disabled player links, or the game identity is
banned. CloudPlayerLinks.Failure.RATE_LIMITED means the gateway's rate limit was hit and the module may
offer a retry. CloudPlayerLinks.Failure.TIMED_OUT and CloudPlayerLinks.Failure.NOT_CONNECTED mean the request never
produced an answer.
Threading. Every call is non-blocking, including create(com.ultikits.ultitools.abstracts.UltiToolsPlugin, java.util.UUID, java.lang.String, com.ultikits.ultitools.websocket.CloudPlayerLinks.GameAuth, java.util.Set<com.ultikits.ultitools.websocket.CloudPlayerLinks.LinkProof>) from the server's
primary thread. The registered CloudPlayerLinks.LinkEventHandler is always called on a framework worker
thread, never on the socket thread or the primary thread; it may do blocking work and must
complete its future from wherever the module's own work finishes. A handler that does not answer
within 30 seconds, or that fails, produces no result, so the gateway redelivers the same completion
later (the module is asked again).
Ownership. Exactly one module owns the handler at a time. It should set the handler when
it is enabled and remove it on unload; while another module owns it, setHandler(com.ultikits.ultitools.abstracts.UltiToolsPlugin, com.ultikits.ultitools.websocket.CloudPlayerLinks.LinkEventHandler) throws
IllegalStateException rather than taking events away from its owner.
- Since:
- 6.3.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhy a link stopped being usable.static enumWhy a link request failed.static enumWhat the handler reports about provisioning a game account for the linked player.static final classWhat this server knows about the player's game authentication when the link is created.static final classOne completed link: how the web user proved the game identity, and what to provision.static final classThe answer to onecreate(com.ultikits.ultitools.abstracts.UltiToolsPlugin, java.util.UUID, java.lang.String, com.ultikits.ultitools.websocket.CloudPlayerLinks.GameAuth, java.util.Set<com.ultikits.ultitools.websocket.CloudPlayerLinks.LinkProof>)call: either a link, or a failure with a safe message.static interfaceReceives completions and expiries of this server's links.static final classOne link that stopped being usable.static enumAn identity proof the server side can support for one link; the gateway decides which of the offered ones it actually accepts.static interfaceThe framework's transport for link messages; internal, not for module use. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCloudPlayerLinks(CloudPlayerLinks.Transport transport) Creates the API over a transport. -
Method Summary
Modifier and TypeMethodDescriptioncreate(UltiToolsPlugin requester, UUID playerUuid, String playerName, CloudPlayerLinks.GameAuth gameAuth, Set<CloudPlayerLinks.LinkProof> offeredProofs) Asks the gateway for a one-time link for one player, without blocking.voidremoveHandler(UltiToolsPlugin owner) Removes the handler whenowneris the module that set it; other owners are ignored.voidsetHandler(UltiToolsPlugin owner, CloudPlayerLinks.LinkEventHandler handler) Registers the handler for completions and expiries of this server's links.
-
Field Details
-
transport
-
-
Constructor Details
-
CloudPlayerLinks
Creates the API over a transport.- Parameters:
transport- the transport that frames and tracks the protocol messages; never null
-
-
Method Details
-
create
public CompletableFuture<CloudPlayerLinks.LinkCreation> create(UltiToolsPlugin requester, UUID playerUuid, String playerName, CloudPlayerLinks.GameAuth gameAuth, Set<CloudPlayerLinks.LinkProof> offeredProofs) Asks the gateway for a one-time link for one player, without blocking.The returned future completes normally with a
CloudPlayerLinks.LinkCreationthat carries the URL or with a failure; it never completes exceptionally for a protocol-level outcome. The framework fillsserverOnlineModeitself. For one link, the creation result is delivered before any completion or expiry of that link.- Parameters:
requester- the calling module, used for ownership and diagnosticsplayerUuid- the player's Minecraft UUIDplayerName- the player's Minecraft name as the module knows itgameAuth- what this server knows about the player's game authenticationofferedProofs- the identity proofs this server can support, one to three of them- Returns:
- a future that completes with the answer, never null
- Throws:
NullPointerException- ifrequester,playerUuidorgameAuthis null, or ifofferedProofsholds a null proofIllegalArgumentException- if the name is null or empty, or the offered proofs are null, empty or hold more than three entries- Since:
- 6.3.1
-
setHandler
Registers the handler for completions and expiries of this server's links.One owner at a time: the same owner may replace its own handler, another owner while one is set is refused. The handler is called off the primary thread.
- Parameters:
owner- the module that owns the handlerhandler- the handler to install- Throws:
IllegalStateException- if a different module already owns the handler- Since:
- 6.3.1
-
removeHandler
Removes the handler whenowneris the module that set it; other owners are ignored. After removal, completions are answered as if no handler were registered.- Parameters:
owner- the module that set the handler- Since:
- 6.3.1
-