Package org.geysermc.floodgate.api.link
Interface PlayerLink
public interface PlayerLink
The base class of the PlayerLink database implementation. The implementation is responsible for
making a connection with the database and keeping that connection alive so that Floodgate (or a
third party plugin) can check for example if a given player is linked.
-
Method Summary
Modifier and TypeMethodDescription@NonNull CompletableFuture<?>createLinkRequest(@NonNull UUID javaId, @NonNull String javaUsername, @NonNull String bedrockUsername) Creates a link request for the given Java player.@NonNull CompletableFuture<org.geysermc.floodgate.util.LinkedPlayer>getLinkedPlayer(@NonNull UUID bedrockId) Get a linked player by the bedrock uuidgetName()Returns the name of this database implementation.longReturns the duration (in seconds) before aLinkRequesttimeoutsbooleanReturn if account linking is allowed.booleanReturn if account linking is enabled.default boolean@NonNull CompletableFuture<Boolean>isLinkedPlayer(@NonNull UUID playerId) Tells if the given player is a linked player@NonNull CompletableFuture<Void>linkPlayer(@NonNull UUID bedrockId, @NonNull UUID javaId, @NonNull String username) Links a Java account to a Bedrock account.voidload()Called by Floodgate after the initialization of the class.voidstop()Called when the Floodgate plugin is going to shutdown@NonNull CompletableFuture<Void>unlinkPlayer(@NonNull UUID javaId) Unlinks a Java account from a Bedrock account.@NonNull CompletableFuture<LinkRequestResult>verifyLinkRequest(@NonNull UUID bedrockId, @NonNull String javaUsername, @NonNull String bedrockUsername, @NonNull String code) Verifies a link request for the given Bedrock player.
-
Method Details
-
load
void load()Called by Floodgate after the initialization of the class. In this method the implementation should start the connection with the database and create the collections if they don't exist already. -
getLinkedPlayer
@NonNull CompletableFuture<org.geysermc.floodgate.util.LinkedPlayer> getLinkedPlayer(@NonNull UUID bedrockId) Get a linked player by the bedrock uuid- Parameters:
bedrockId- the uuid of the bedrock player- Returns:
- a completable future with the
LinkedPlayer. The future will have a null value if that Bedrock player isn't linked
-
isLinkedPlayer
Tells if the given player is a linked player- Parameters:
playerId- the uuid of the player to check, can be both a Java or a Bedrock uuid- Returns:
- true if the player is a linked player
-
linkPlayer
@NonNull CompletableFuture<Void> linkPlayer(@NonNull UUID bedrockId, @NonNull UUID javaId, @NonNull String username) Links a Java account to a Bedrock account.- Parameters:
bedrockId- the uuid of the Bedrock playerjavaId- the uuid of the Java playerusername- the username of the Java player- Returns:
- a future holding void on success or completed exceptionally when failed
-
unlinkPlayer
Unlinks a Java account from a Bedrock account.- Parameters:
javaId- the uuid of the Java player- Returns:
- a future holding void on success or completed exceptionally when failed
-
createLinkRequest
@NonNull CompletableFuture<?> createLinkRequest(@NonNull UUID javaId, @NonNull String javaUsername, @NonNull String bedrockUsername) Creates a link request for the given Java player.- Parameters:
javaId- the uuid of the Java playerjavaUsername- the username of the Java playerbedrockUsername- the username of the Bedrock player receiving the link request- Returns:
- a future holding the result of the link request which will be a
LinkRequestResulton failure and the link code (string) on success
-
verifyLinkRequest
@NonNull CompletableFuture<LinkRequestResult> verifyLinkRequest(@NonNull UUID bedrockId, @NonNull String javaUsername, @NonNull String bedrockUsername, @NonNull String code) Verifies a link request for the given Bedrock player.- Parameters:
bedrockId- the uuid of the Bedrock playerjavaUsername- the username of the Java players who requested the linkbedrockUsername- the username of the Bedrock playercode- the code created increateLinkRequest(UUID, String, String)- Returns:
- a future holding the result of the link verification
-
getName
String getName()Returns the name of this database implementation. This will return null when Player Linking is disabled or when only Global Linking is used. -
isEnabled
boolean isEnabled()Return if account linking is enabled. The difference between enabled and allowed is that 'enabled' still allows already linked people to join with their linked account while 'allow linking' allows people to link accounts using the commands. -
getVerifyLinkTimeout
long getVerifyLinkTimeout()Returns the duration (in seconds) before aLinkRequesttimeouts -
isAllowLinking
boolean isAllowLinking()Return if account linking is allowed. The difference between enabled and allowed is that 'enabled' still allows already linked people to join with their linked account while 'allow linking' allows people to link accounts using the commands. -
isEnabledAndAllowed
default boolean isEnabledAndAllowed() -
stop
void stop()Called when the Floodgate plugin is going to shutdown
-