mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2024-11-21 11:45:11 +01:00
update migrator
This commit is contained in:
parent
f18a162897
commit
65d0f9b6ce
@ -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());
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user