Interface DiscordLinkService
- All Known Implementing Classes:
AccountLinkManager
public interface DiscordLinkService
A class which provides numerous methods to interact with the link module for EssentialsX Discord.
-
Method Summary
Modifier and TypeMethodDescriptionGets a map of all linked players, where the key is the Minecraft UUID and the value is the Discord ID.getDiscordId
(UUID uuid) Gets the Discord ID linked to the givenUUID
ornull
if none is present.Gets theUUID
linked to the given Discord ID ornull
if none is present.default boolean
Checks if there is a Minecraft account linked to the given Discord ID.default boolean
Checks if there is a Discord account linked to the givenUUID
.boolean
linkAccount
(UUID uuid, net.essentialsx.api.v2.services.discord.InteractionMember member) Links the givenUUID
to the givenInteractionMember
.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).
-
Method Details
-
getDiscordId
Gets the Discord ID linked to the givenUUID
ornull
if none is present.- Parameters:
uuid
- theUUID
of the player to lookup.- Returns:
- the Discord ID or
null
.
-
isLinked
Checks if there is a Discord account linked to the givenUUID
. -
getUUID
Gets theUUID
linked to the given Discord ID ornull
if none is present.- Parameters:
discordId
- The Discord ID to lookup.- Returns:
- the
UUID
ornull
.
-
isLinked
Checks if there is a Minecraft account linked to the given Discord ID.- Parameters:
discordId
- the Discord ID to check.- Returns:
- true if there is a Minecraft account linked to the given Discord ID.
-
linkAccount
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.- 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.
- Throws:
IllegalArgumentException
- if either of theUUID
orInteractionMember
are null.- See Also:
-
unlinkAccount
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
.- Parameters:
uuid
- TheUUID
of the player to unlink.- Returns:
- true if there was an account associated with the given
UUID
, otherwise false. - Throws:
IllegalArgumentException
- if the providedUUID
is null.
-
unlinkAccount
boolean unlinkAccount(net.essentialsx.api.v2.services.discord.InteractionMember member) 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
.- Parameters:
member
- TheInteractionMember
to unlink.- Returns:
- true if there was a linked Minecraft account associated with the given
InteractionMember
, otherwise false. - Throws:
IllegalArgumentException
- if the providedInteractionMember
is null.
-
getAllLinkedPlayers
Gets a map of all linked players, where the key is the Minecraft UUID and the value is the Discord ID. The returned map is immutable and cannot be modified.- Returns:
- an immutable map of all linked players.
-