Skip to content

Commit

Permalink
Add method to get all linked players in DiscordLinkService
Browse files Browse the repository at this point in the history
  • Loading branch information
carlodrift committed Aug 15, 2024
1 parent 7b02d22 commit daa4893
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.essentialsx.api.v2.services.discord.InteractionMember;

import java.util.Map;
import java.util.UUID;

/**
Expand Down Expand Up @@ -82,4 +83,12 @@ default boolean isLinked(final String discordId) {
* {@link InteractionMember}, otherwise false.
*/
boolean unlinkAccount(final InteractionMember member);

/**
* 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.
*
* @return an immutable map of all linked players.
*/
Map<String, String> getAllLinkedPlayers();
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.essentialsx.api.v2.services.discordlink.DiscordLinkService;
import net.essentialsx.discordlink.rolesync.RoleSyncManager;

import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.Random;
Expand Down Expand Up @@ -162,4 +163,9 @@ private String generateCode() {
}
return result;
}

@Override
public Map<String, String> getAllLinkedPlayers() {
return Collections.unmodifiableMap(storage.getRawStorageMap());
}
}

0 comments on commit daa4893

Please sign in to comment.