mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2025-02-12 03:59:22 +00:00
Safer UUID provider
This commit is contained in:
parent
5a842842a2
commit
d2ef1c350a
1 changed files with 14 additions and 5 deletions
|
@ -315,15 +315,24 @@ public class UUIDHandler {
|
|||
return uuidWrapper.getUUID(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely provide the correct UUID provider. Ignores user preference if not possible rather than break the plugin.
|
||||
*/
|
||||
public static UUID getUUID(OfflinePlayer player) {
|
||||
if (uuidWrapper == null) {
|
||||
try {
|
||||
getUUID(player);
|
||||
uuidWrapper = new DefaultUUIDWrapper();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
|
||||
if (Settings.OFFLINE_MODE) {
|
||||
uuidWrapper = new OfflineUUIDWrapper();
|
||||
}
|
||||
else {
|
||||
try {
|
||||
getUUID(player);
|
||||
uuidWrapper = new DefaultUUIDWrapper();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
uuidWrapper = new OfflineUUIDWrapper();
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
return uuidWrapper.getUUID(player);
|
||||
|
|
Loading…
Reference in a new issue