mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-12 11:21:16 +01:00
[#877] Made player pages accessible via UUIDs
This commit is contained in:
parent
baca629857
commit
96d6e301dd
@ -51,23 +51,46 @@ public class UUIDUtility {
|
|||||||
* @return UUID of the player
|
* @return UUID of the player
|
||||||
*/
|
*/
|
||||||
public UUID getUUIDOf(String playerName) {
|
public UUID getUUIDOf(String playerName) {
|
||||||
UUID uuid = null;
|
UUID uuid = getUUIDFromString(playerName);
|
||||||
UUID uuidOf = dataCache.getUUIDof(playerName);
|
if (uuid != null) {
|
||||||
if (uuidOf != null) {
|
return uuid;
|
||||||
return uuidOf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uuid = dataCache.getUUIDof(playerName);
|
||||||
|
if (uuid != null) {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
uuid = getUUIDFromDB(playerName);
|
||||||
|
if (uuid != null) {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getUUIDViaUUIDFetcher(playerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private UUID getUUIDFromString(String playerName) {
|
||||||
try {
|
try {
|
||||||
uuid = dbSystem.getDatabase().fetch().getUuidOf(playerName);
|
return UUID.fromString(playerName);
|
||||||
|
} catch (IllegalArgumentException ignore) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private UUID getUUIDViaUUIDFetcher(String playerName) {
|
||||||
|
try {
|
||||||
|
return UUIDFetcher.getUUIDOf(playerName);
|
||||||
|
} catch (Exception | NoClassDefFoundError ignored) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private UUID getUUIDFromDB(String playerName) {
|
||||||
|
try {
|
||||||
|
return dbSystem.getDatabase().fetch().getUuidOf(playerName);
|
||||||
} catch (DBOpException e) {
|
} catch (DBOpException e) {
|
||||||
errorHandler.log(L.ERROR, UUIDUtility.class, e);
|
errorHandler.log(L.ERROR, UUIDUtility.class, e);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
if (uuid == null) {
|
|
||||||
uuid = UUIDFetcher.getUUIDOf(playerName);
|
|
||||||
}
|
|
||||||
} catch (Exception | NoClassDefFoundError ignored) {
|
|
||||||
/* Ignored */
|
|
||||||
}
|
|
||||||
return uuid;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user