Skip to content

Commit

Permalink
Return immutable map in DiscordLinkService getAllLinkedPlayers
Browse files Browse the repository at this point in the history
  • Loading branch information
carlodrift committed Aug 9, 2024
1 parent 51dc5a4 commit a4a4464
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ default boolean isLinked(final String discordId) {

/**
* Gets a map of all linked players, where the key is the Discord ID and the value is the Minecraft UUID.
* @return a map of all linked players.
* 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 @@ -165,6 +166,6 @@ private String generateCode() {

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

0 comments on commit a4a4464

Please sign in to comment.