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); } }