diff --git a/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java b/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java index 1a040c8..f1fd29c 100644 --- a/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java +++ b/src/main/java/com/badbones69/crazyauctions/CrazyAuctions.java @@ -70,7 +70,7 @@ public class CrazyAuctions extends JavaPlugin { final String uuid = configuration.getString("OutOfTime/Cancelled." + key + ".Seller"); if (uuid != null) { - OfflinePlayer player = Methods.getOfflinePlayer(uuid); + OfflinePlayer player = Methods.getOfflinePlayer(uuid, false); configuration.set("OutOfTime/Cancelled." + key + ".Seller", player.getUniqueId().toString()); @@ -92,7 +92,7 @@ public class CrazyAuctions extends JavaPlugin { final String uuid = configuration.getString("Items." + key + ".Seller"); if (uuid != null) { - OfflinePlayer player = Methods.getOfflinePlayer(uuid); + OfflinePlayer player = Methods.getOfflinePlayer(uuid, false); if (!uuid.equals(player.getUniqueId().toString())) { configuration.set("Items." + key + ".Seller", player.getUniqueId().toString()); @@ -104,7 +104,7 @@ public class CrazyAuctions extends JavaPlugin { final String bidder = configuration.getString("Items." + key + ".TopBidder"); if (bidder != null && !bidder.equals("None")) { - OfflinePlayer player = Methods.getOfflinePlayer(bidder); + OfflinePlayer player = Methods.getOfflinePlayer(bidder, false); if (!bidder.equals(player.getUniqueId().toString())) { configuration.set("Items." + key + ".TopBidder", player.getUniqueId().toString()); diff --git a/src/main/java/com/badbones69/crazyauctions/Methods.java b/src/main/java/com/badbones69/crazyauctions/Methods.java index 09780f8..5885b72 100644 --- a/src/main/java/com/badbones69/crazyauctions/Methods.java +++ b/src/main/java/com/badbones69/crazyauctions/Methods.java @@ -11,6 +11,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import java.util.*; +import java.util.concurrent.CompletableFuture; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -84,6 +85,14 @@ public class Methods { } public static OfflinePlayer getOfflinePlayer(String name) { + return getOfflinePlayer(name, true); + } + + public static OfflinePlayer getOfflinePlayer(String name, boolean fetchUUID) { + if (!fetchUUID) { + return CompletableFuture.supplyAsync(() -> plugin.getServer().getOfflinePlayer(name)).join(); + } + return plugin.getServer().getOfflinePlayer(UUID.fromString(name)); }