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, the game identity is
banned, or none of the offered proofs is acceptable for the reported game authentication.
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(UltiToolsPlugin, UUID, String, CloudPlayerLinks.GameAuth, Set) 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. At most one module or external plugin owns the handler at a time. A different owner cannot replace it. An external plugin must connect to UltiTools before registering the handler; disconnecting it releases its handler.
- 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(UltiToolsPlugin, UUID, String, CloudPlayerLinks.GameAuth, Set)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.create(org.bukkit.plugin.java.JavaPlugin requester, UUID playerUuid, String playerName, CloudPlayerLinks.GameAuth gameAuth, Set<CloudPlayerLinks.LinkProof> offeredProofs) Asks the gateway for a one-time link on behalf of an external plugin, without blocking.voidremoveHandler(UltiToolsPlugin owner) Removes the handler whenowneris the module that set it; other owners are ignored.voidremoveHandler(org.bukkit.plugin.java.JavaPlugin owner) Removes the handler if it belongs to this external plugin.voidsetHandler(UltiToolsPlugin owner, CloudPlayerLinks.LinkEventHandler handler) Registers the handler for completions and expiries of this server's links.voidsetHandler(org.bukkit.plugin.java.JavaPlugin owner, CloudPlayerLinks.LinkEventHandler handler) Registers the single handler for this server's links on behalf of a connected external plugin.private static voidvalidateCreate(UUID playerUuid, String playerName, CloudPlayerLinks.GameAuth gameAuth, Set<CloudPlayerLinks.LinkProof> offeredProofs)
-
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
-
create
public CompletableFuture<CloudPlayerLinks.LinkCreation> create(org.bukkit.plugin.java.JavaPlugin requester, UUID playerUuid, String playerName, CloudPlayerLinks.GameAuth gameAuth, Set<CloudPlayerLinks.LinkProof> offeredProofs) Asks the gateway for a one-time link on behalf of an external plugin, without blocking. The input and result contract is the same as for a module.- Parameters:
requester- the calling external pluginplayerUuid- the player's Minecraft UUIDplayerName- the player's Minecraft name as the plugin 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
- Since:
- 7.2.0
- See Also:
-
validateCreate
private static void validateCreate(UUID playerUuid, String playerName, CloudPlayerLinks.GameAuth gameAuth, Set<CloudPlayerLinks.LinkProof> offeredProofs) -
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 or external plugin already owns the handler- Since:
- 6.3.1
-
setHandler
public void setHandler(org.bukkit.plugin.java.JavaPlugin owner, CloudPlayerLinks.LinkEventHandler handler) Registers the single handler for this server's links on behalf of a connected external plugin. Call afterUltiToolsAPI.connect(JavaPlugin); disconnecting releases the handler automatically. The same owner may replace its handler, and callbacks run off the primary thread.- Parameters:
owner- the connected external pluginhandler- the handler to install- Throws:
IllegalStateException- if the plugin is not connected or a different owner already holds the handler- Since:
- 7.2.0
-
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
-
removeHandler
public void removeHandler(org.bukkit.plugin.java.JavaPlugin owner) Removes the handler if it belongs to this external plugin. Other owners are ignored. After removal, completions are answered as if no handler were registered.- Parameters:
owner- the external plugin that set the handler- Since:
- 7.2.0
-