mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-19 14:59:20 +00:00
Removed some debug code. Allow database impls to handle link requests
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.api.link;
|
||||
|
||||
/**
|
||||
* This enum has all the available result types of both creating a player link request and
|
||||
* validating it.
|
||||
*/
|
||||
public enum LinkRequestResult {
|
||||
/**
|
||||
* An unknown error encountered while creating / verifying the link request.
|
||||
*/
|
||||
UNKNOWN_ERROR,
|
||||
/**
|
||||
* @deprecated this result isn't used. Instead the link code is returned
|
||||
*/
|
||||
REQUEST_CREATED,
|
||||
/**
|
||||
* The specified bedrock username is already linked to a Java account.
|
||||
*/
|
||||
ALREADY_LINKED,
|
||||
/**
|
||||
* The Bedrock player verified the request too late. The request has been expired.
|
||||
*/
|
||||
REQUEST_EXPIRED,
|
||||
/**
|
||||
* The Java player hasn't requested a link to this Bedrock account.
|
||||
*/
|
||||
NO_LINK_REQUESTED,
|
||||
/**
|
||||
* The entered code is invalid.
|
||||
*/
|
||||
INVALID_CODE,
|
||||
/**
|
||||
* The link request has been verified successfully!
|
||||
*/
|
||||
LINK_COMPLETED
|
||||
}
|
||||
@@ -54,10 +54,10 @@ public interface PlayerLink {
|
||||
/**
|
||||
* Tells if the given player is a linked player
|
||||
*
|
||||
* @param bedrockId the bedrock uuid of the linked player
|
||||
* @param playerId the uuid of the player to check, can be both a Java or a Bedrock uuid
|
||||
* @return true if the player is a linked player
|
||||
*/
|
||||
CompletableFuture<Boolean> isLinkedPlayer(UUID bedrockId);
|
||||
CompletableFuture<Boolean> isLinkedPlayer(UUID playerId);
|
||||
|
||||
/**
|
||||
* Links a Java account to a Bedrock account.
|
||||
@@ -77,6 +77,37 @@ public interface PlayerLink {
|
||||
*/
|
||||
CompletableFuture<Void> unlinkPlayer(UUID javaId);
|
||||
|
||||
/**
|
||||
* Creates a link request for the given Java player.
|
||||
*
|
||||
* @param javaId the uuid of the Java player
|
||||
* @param javaUsername the username of the Java player
|
||||
* @param bedrockUsername the username of the Bedrock player receiving the link request
|
||||
* @return a future holding the result of the link request which will be a {@link
|
||||
* LinkRequestResult} on failure and the link code (string) on success
|
||||
*/
|
||||
CompletableFuture<?> createLinkRequest(
|
||||
UUID javaId,
|
||||
String javaUsername,
|
||||
String bedrockUsername
|
||||
);
|
||||
|
||||
/**
|
||||
* Verifies a link request for the given Bedrock player.
|
||||
*
|
||||
* @param bedrockId the uuid of the Bedrock player
|
||||
* @param javaUsername the username of the Java players who requested the link
|
||||
* @param bedrockUsername the username of the Bedrock player
|
||||
* @param code the code created in {@link #createLinkRequest(UUID, String, String)}
|
||||
* @return a future holding the result of the link verification
|
||||
*/
|
||||
CompletableFuture<LinkRequestResult> verifyLinkRequest(
|
||||
UUID bedrockId,
|
||||
String javaUsername,
|
||||
String bedrockUsername,
|
||||
String code
|
||||
);
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
Reference in New Issue
Block a user