Package net.essentialsx.discordlink
Class AccountLinkManager
java.lang.Object
net.essentialsx.discordlink.AccountLinkManager
- All Implemented Interfaces:
com.earth2me.essentials.IEssentialsModule
,DiscordLinkService
public class AccountLinkManager
extends Object
implements com.earth2me.essentials.IEssentialsModule, DiscordLinkService
-
Constructor Summary
ConstructorDescriptionAccountLinkManager
(EssentialsDiscordLink ess, AccountStorage storage, RoleSyncManager roleSyncManager) -
Method Summary
Modifier and TypeMethodDescriptioncreateCode
(UUID uuid) getDiscordId
(UUID uuid) Gets the Discord ID linked to the givenUUID
ornull
if none is present.getPendingUUID
(String code) net.ess3.api.IUser
Gets theUUID
linked to the given Discord ID ornull
if none is present.boolean
linkAccount
(UUID uuid, net.essentialsx.api.v2.services.discord.InteractionMember member) Links the givenUUID
to the givenInteractionMember
.void
registerAccount
(UUID uuid, net.essentialsx.api.v2.services.discord.InteractionMember member, DiscordLinkStatusChangeEvent.Cause cause) boolean
removeAccount
(net.ess3.api.IUser user, DiscordLinkStatusChangeEvent.Cause cause) boolean
removeAccount
(net.essentialsx.api.v2.services.discord.InteractionMember member, DiscordLinkStatusChangeEvent.Cause cause) boolean
unlinkAccount
(UUID uuid) Unlinks the givenUUID
with its associated Discord account (if present).boolean
unlinkAccount
(net.essentialsx.api.v2.services.discord.InteractionMember member) Unlinks the givenInteractionMember
with its associated Minecraft account (if present).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.essentialsx.api.v2.services.discordlink.DiscordLinkService
isLinked, isLinked
-
Constructor Details
-
AccountLinkManager
public AccountLinkManager(EssentialsDiscordLink ess, AccountStorage storage, RoleSyncManager roleSyncManager)
-
-
Method Details
-
createCode
- Throws:
IllegalArgumentException
-
getPendingUUID
-
getDiscordId
Description copied from interface:DiscordLinkService
Gets the Discord ID linked to the givenUUID
ornull
if none is present.- Specified by:
getDiscordId
in interfaceDiscordLinkService
- Parameters:
uuid
- theUUID
of the player to lookup.- Returns:
- the Discord ID or
null
.
-
getUser
-
getUUID
Description copied from interface:DiscordLinkService
Gets theUUID
linked to the given Discord ID ornull
if none is present.- Specified by:
getUUID
in interfaceDiscordLinkService
- Parameters:
discordId
- The Discord ID to lookup.- Returns:
- the
UUID
ornull
.
-
unlinkAccount
public boolean unlinkAccount(net.essentialsx.api.v2.services.discord.InteractionMember member) Description copied from interface:DiscordLinkService
Unlinks the givenInteractionMember
with its associated Minecraft account (if present).This will automatically trigger role unsync (if configured) for the given
InteractionMember
if this method returnstrue
.- Specified by:
unlinkAccount
in interfaceDiscordLinkService
- Parameters:
member
- TheInteractionMember
to unlink.- Returns:
- true if there was a linked Minecraft account associated with the given
InteractionMember
, otherwise false.
-
removeAccount
public boolean removeAccount(net.essentialsx.api.v2.services.discord.InteractionMember member, DiscordLinkStatusChangeEvent.Cause cause) -
unlinkAccount
Description copied from interface:DiscordLinkService
Unlinks the givenUUID
with its associated Discord account (if present).This will automatically trigger role unsync (if configured) for the given player if this method returns
true
.- Specified by:
unlinkAccount
in interfaceDiscordLinkService
- Parameters:
uuid
- TheUUID
of the player to unlink.- Returns:
- true if there was an account associated with the given
UUID
, otherwise false.
-
removeAccount
-
linkAccount
public boolean linkAccount(UUID uuid, net.essentialsx.api.v2.services.discord.InteractionMember member) Description copied from interface:DiscordLinkService
Links the givenUUID
to the givenInteractionMember
.This will automatically trigger role sync (if configured) for the given player if this method returns
true
.This method will return true if the accounts are successfully linked, or false if either the provided
UUID
orInteractionMember
are already linked to another account.- Specified by:
linkAccount
in interfaceDiscordLinkService
- Parameters:
uuid
- TheUUID
of the target player.member
- TheInteractionMember
to link to the target player.- Returns:
- true if the accounts were linked successfully, otherwise false.
- See Also:
-
registerAccount
public void registerAccount(UUID uuid, net.essentialsx.api.v2.services.discord.InteractionMember member, DiscordLinkStatusChangeEvent.Cause cause)
-