Skip to content

Commit

Permalink
ignore name capitalization in identity caching
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Nov 12, 2023
1 parent 0d12203 commit d9217a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/vc/util/PlayerLookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public PlayerLookup(final ProfileApi mojangApi, final UuidApi mineToolsApi) {
public record PlayerIdentity(UUID uuid, String playerName) { }

public Optional<PlayerIdentity> getPlayerIdentity(final String playerName) {
final PlayerIdentity identityFromCache = uuidCache.getIfPresent(playerName);
final PlayerIdentity identityFromCache = uuidCache.getIfPresent(playerName.toLowerCase().trim());
if (identityFromCache != null)
return Optional.of(identityFromCache);

Optional<PlayerIdentity> playerIdentity = lookupIdentityMojang(playerName).or(() -> lookupIdentityMinetools(playerName));
playerIdentity.ifPresent(identity -> uuidCache.put(playerName, identity));
playerIdentity.ifPresent(identity -> uuidCache.put(playerName.toLowerCase().trim(), identity));
return playerIdentity;
}

Expand Down

0 comments on commit d9217a2

Please sign in to comment.