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 Details

  • Method Details

    • createCode

      public String createCode(UUID uuid) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • getPendingUUID

      public UUID getPendingUUID(String code)
    • getDiscordId

      public String getDiscordId(UUID uuid)
      Description copied from interface: DiscordLinkService
      Gets the Discord ID linked to the given UUID or null if none is present.
      Specified by:
      getDiscordId in interface DiscordLinkService
      Parameters:
      uuid - the UUID of the player to lookup.
      Returns:
      the Discord ID or null.
    • getUser

      public net.ess3.api.IUser getUser(String discordId)
    • getUUID

      public UUID getUUID(String discordId)
      Description copied from interface: DiscordLinkService
      Gets the UUID linked to the given Discord ID or null if none is present.
      Specified by:
      getUUID in interface DiscordLinkService
      Parameters:
      discordId - The Discord ID to lookup.
      Returns:
      the UUID or null.
    • unlinkAccount

      public boolean unlinkAccount(net.essentialsx.api.v2.services.discord.InteractionMember member)
      Description copied from interface: DiscordLinkService
      Unlinks the given InteractionMember with its associated Minecraft account (if present).

      This will automatically trigger role unsync (if configured) for the given InteractionMember if this method returns true.

      Specified by:
      unlinkAccount in interface DiscordLinkService
      Parameters:
      member - The InteractionMember 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

      public boolean unlinkAccount(UUID uuid)
      Description copied from interface: DiscordLinkService
      Unlinks the given UUID 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 interface DiscordLinkService
      Parameters:
      uuid - The UUID of the player to unlink.
      Returns:
      true if there was an account associated with the given UUID, otherwise false.
    • removeAccount

      public boolean removeAccount(net.ess3.api.IUser user, DiscordLinkStatusChangeEvent.Cause cause)
    • linkAccount

      public boolean linkAccount(UUID uuid, net.essentialsx.api.v2.services.discord.InteractionMember member)
      Description copied from interface: DiscordLinkService
      Links the given UUID to the given InteractionMember.

      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 or InteractionMember are already linked to another account.

      Specified by:
      linkAccount in interface DiscordLinkService
      Parameters:
      uuid - The UUID of the target player.
      member - The InteractionMember 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)
    • getAllLinkedPlayers

      public Map<String,String> getAllLinkedPlayers()
      Description copied from interface: DiscordLinkService
      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.
      Specified by:
      getAllLinkedPlayers in interface DiscordLinkService
      Returns:
      an immutable map of all linked players.