From 8fa0f73a46a5e452dc12c57580704ea394659193 Mon Sep 17 00:00:00 2001 From: Andre601 <11576465+Andre601@users.noreply.github.com> Date: Thu, 31 Dec 2020 18:20:11 +0100 Subject: [PATCH 1/2] Fix resolvePlayer method --- .../placeholderapi/commands/impl/local/CommandParse.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java b/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java index 5231ebf..a4cd2b3 100644 --- a/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java +++ b/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java @@ -212,12 +212,15 @@ public final class CommandParse extends PlaceholderCommand { @Nullable private OfflinePlayer resolvePlayer(@NotNull final String name) { OfflinePlayer target = Bukkit.getPlayer(name); - + if (target == null) { - target = Bukkit.getOfflinePlayer(name); // this is probably not a great idea. + // Not the best option, but Spigot doesn't offer a good replacement (as usual) + target = Bukkit.getOfflinePlayer(name); + + return target.hasPlayedBefore() ? target : null; } - return target.hasPlayedBefore() ? target : null; + return target; } From 6a69ec833f19cb3493dcfd79f5b97511f778507b Mon Sep 17 00:00:00 2001 From: Andre601 <11576465+Andre601@users.noreply.github.com> Date: Fri, 1 Jan 2021 18:19:07 +0100 Subject: [PATCH 2/2] Use getPlayerExact --- .../clip/placeholderapi/commands/impl/local/CommandParse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java b/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java index a4cd2b3..3bd8bc2 100644 --- a/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java +++ b/src/main/java/me/clip/placeholderapi/commands/impl/local/CommandParse.java @@ -211,7 +211,7 @@ public final class CommandParse extends PlaceholderCommand { @Nullable private OfflinePlayer resolvePlayer(@NotNull final String name) { - OfflinePlayer target = Bukkit.getPlayer(name); + OfflinePlayer target = Bukkit.getPlayerExact(name); if (target == null) { // Not the best option, but Spigot doesn't offer a good replacement (as usual)