mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2025-08-08 05:23:01 +00:00
UUIDs are now Abstract
This commit is contained in:
parent
176baa5c0d
commit
7b203261a3
14 changed files with 129 additions and 23 deletions
|
@ -62,6 +62,8 @@ import java.util.UUID;
|
|||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class UUIDHandler {
|
||||
|
||||
public static UUIDWrapper uuidWrapper = null;
|
||||
|
||||
/**
|
||||
* Online mode
|
||||
|
@ -133,7 +135,7 @@ public class UUIDHandler {
|
|||
@SuppressWarnings("deprecation")
|
||||
final Player player = Bukkit.getPlayer(name);
|
||||
if (player != null) {
|
||||
final UUID uuid = player.getUniqueId();
|
||||
final UUID uuid = getUUID(player);
|
||||
add(nameWrap, uuid);
|
||||
return uuid;
|
||||
}
|
||||
|
@ -282,7 +284,7 @@ public class UUIDHandler {
|
|||
if (player == null) {
|
||||
return null;
|
||||
}
|
||||
final UUID uuid = player.getUniqueId();
|
||||
final UUID uuid = getUUID(player);
|
||||
add(name, uuid);
|
||||
return uuid;
|
||||
}
|
||||
|
@ -297,4 +299,30 @@ public class UUIDHandler {
|
|||
final UUIDSaver saver = PlotMain.getUUIDSaver();
|
||||
saver.globalSave(getUuidMap());
|
||||
}
|
||||
|
||||
public static UUID getUUID(Player player) {
|
||||
if (uuidWrapper == null) {
|
||||
try {
|
||||
getUUID(player);
|
||||
uuidWrapper = new DefaultUUIDWrapper();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
uuidWrapper = new OfflineUUIDWrapper();
|
||||
}
|
||||
}
|
||||
return uuidWrapper.getUUID(player);
|
||||
}
|
||||
|
||||
public static UUID getUUID(OfflinePlayer player) {
|
||||
if (uuidWrapper == null) {
|
||||
try {
|
||||
getUUID(player);
|
||||
uuidWrapper = new DefaultUUIDWrapper();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
uuidWrapper = new OfflineUUIDWrapper();
|
||||
}
|
||||
}
|
||||
return uuidWrapper.getUUID(player);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue