From e4c23a777e15370d9b54f8cdb77ac54df1615b1f Mon Sep 17 00:00:00 2001 From: Lishid Date: Fri, 10 Jul 2015 16:01:28 -0700 Subject: [PATCH] Reworked UUID logic --- .../com/lishid/openinv/utils/UUIDUtil.java | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/lishid/openinv/utils/UUIDUtil.java b/src/main/java/com/lishid/openinv/utils/UUIDUtil.java index ea7c038..d92a4f0 100644 --- a/src/main/java/com/lishid/openinv/utils/UUIDUtil.java +++ b/src/main/java/com/lishid/openinv/utils/UUIDUtil.java @@ -40,33 +40,23 @@ public class UUIDUtil { } public static UUID getUUIDOf(String name) { - UUID uuid; Player player = getPlayer(name); if (player != null) { - uuid = player.getUniqueId(); + return player.getUniqueId(); } - else { - if (Bukkit.getServer().getOnlineMode()) { - if (!Bukkit.getServer().isPrimaryThread()) { - UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name)); - Map response; - try { - response = fetcher.call(); - uuid = response.get(name.toLowerCase()); - } - catch (Exception e) { - uuid = getUUIDLocally(name); - } - } else { - uuid = getUUIDLocally(name); - } - } else { - uuid = getUUIDLocally(name); + if (Bukkit.getServer().getOnlineMode() && !Bukkit.getServer().isPrimaryThread()) { + UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name)); + try { + Map response = fetcher.call(); + return response.get(name.toLowerCase()); + } + catch (Exception ignored) { + //Fallthrough to end of method } } - return uuid; + return getUUIDLocally(name); } }