Reworked UUID logic

This commit is contained in:
Lishid 2015-07-10 16:01:28 -07:00
parent 4f40459b96
commit e4c23a777e

View file

@ -40,33 +40,23 @@ public class UUIDUtil {
} }
public static UUID getUUIDOf(String name) { public static UUID getUUIDOf(String name) {
UUID uuid;
Player player = getPlayer(name); Player player = getPlayer(name);
if (player != null) { if (player != null) {
uuid = player.getUniqueId(); return player.getUniqueId();
} }
else {
if (Bukkit.getServer().getOnlineMode()) { if (Bukkit.getServer().getOnlineMode() && !Bukkit.getServer().isPrimaryThread()) {
if (!Bukkit.getServer().isPrimaryThread()) {
UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name)); UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name));
Map<String, UUID> response;
try { try {
response = fetcher.call(); Map<String, UUID> response = fetcher.call();
uuid = response.get(name.toLowerCase()); return response.get(name.toLowerCase());
} }
catch (Exception e) { catch (Exception ignored) {
uuid = getUUIDLocally(name); //Fallthrough to end of method
}
} else {
uuid = getUUIDLocally(name);
}
} else {
uuid = getUUIDLocally(name);
} }
} }
return uuid; return getUUIDLocally(name);
} }
} }