Skip to content

Commit

Permalink
Don't replace placeholder if given player identifier is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraLS3 committed May 28, 2022
1 parent 3119f35 commit 8ee494f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,14 @@ public String onPlaceholderRequest(UUID uuid, String placeholder, List<String> p
return Objects.toString(staticLoader.apply(arguments));
}

UUID playerUUID = arguments.get(0)
.flatMap(this::getPlayerUUIDForIdentifier)
.orElse(uuid);
Optional<String> givenIdentifier = arguments.get(0);
Optional<UUID> foundUUID = givenIdentifier
.flatMap(this::getPlayerUUIDForIdentifier);
UUID playerUUID = foundUUID.orElse(uuid);
PlayerContainer player;
if (playerUUID != null) {
if (givenIdentifier.isPresent() && !foundUUID.isPresent()) {
player = null; // Don't show other player whose identifier is not found.
} else if (playerUUID != null) {
player = dbSystem.getDatabase().query(ContainerFetchQueries.fetchPlayerContainer(playerUUID));
} else {
player = null;
Expand Down

0 comments on commit 8ee494f

Please sign in to comment.