From 3fb0176c5d6f8e74cece60c2f87dcc1aba44aa56 Mon Sep 17 00:00:00 2001 From: fullwall Date: Tue, 5 Aug 2014 22:32:31 -0700 Subject: [PATCH] Fix skin loading --- .../npc/entity/HumanController.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/citizensnpcs/npc/entity/HumanController.java b/src/main/java/net/citizensnpcs/npc/entity/HumanController.java index cc2cfb621..d63740fba 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/HumanController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/HumanController.java @@ -119,12 +119,12 @@ public class HumanController extends AbstractEntityController { private GameProfile fillProfileProperties(YggdrasilAuthenticationService auth, GameProfile profile, boolean requireSecure) throws Exception { URL url = HttpAuthenticationService.constantURL(new StringBuilder() - .append("https://sessionserver.mojang.com/session/minecraft/profile/") - .append(UUIDTypeAdapter.fromUUID(profile.getId())).toString()); + .append("https://sessionserver.mojang.com/session/minecraft/profile/") + .append(UUIDTypeAdapter.fromUUID(profile.getId())).toString()); url = HttpAuthenticationService.concatenateURL(url, new StringBuilder().append("unsigned=").append(!requireSecure).toString()); - MinecraftProfilePropertiesResponse response = (MinecraftProfilePropertiesResponse) MAKE_REQUEST.invoke(url, - null, MinecraftProfilePropertiesResponse.class); + MinecraftProfilePropertiesResponse response = (MinecraftProfilePropertiesResponse) MAKE_REQUEST.invoke( + auth, url, null, MinecraftProfilePropertiesResponse.class); if (response == null) { return profile; } @@ -140,6 +140,7 @@ public class HumanController extends AbstractEntityController { try { realUUID = uuid.call(); } catch (Exception e) { + e.printStackTrace(); return; } GameProfile skinProfile = null; @@ -150,6 +151,8 @@ public class HumanController extends AbstractEntityController { } catch (Exception e) { if (e.getMessage().contains("too many requests")) { Bukkit.getScheduler().runTaskLaterAsynchronously(CitizensAPI.getPlugin(), this, 200); + } else { + e.printStackTrace(); } return; } @@ -201,18 +204,18 @@ public class HumanController extends AbstractEntityController { .getGameProfileRepository(); repo.findProfilesByNames(new String[] { ChatColor.stripColor(reportedUUID) }, Agent.MINECRAFT, new ProfileLookupCallback() { - @Override - public void onProfileLookupFailed(GameProfile arg0, Exception arg1) { - throw new RuntimeException(arg1); - } + @Override + public void onProfileLookupFailed(GameProfile arg0, Exception arg1) { + throw new RuntimeException(arg1); + } - @Override - public void onProfileLookupSucceeded(final GameProfile profile) { - UUID_CACHE.put(reportedUUID, profile.getId().toString()); - npc.data().setPersistent(CACHED_SKIN_UUID_METADATA, profile.getId().toString()); - npc.data().setPersistent(CACHED_SKIN_UUID_NAME_METADATA, profile.getName()); - } - }); + @Override + public void onProfileLookupSucceeded(final GameProfile profile) { + UUID_CACHE.put(reportedUUID, profile.getId().toString()); + npc.data().setPersistent(CACHED_SKIN_UUID_METADATA, profile.getId().toString()); + npc.data().setPersistent(CACHED_SKIN_UUID_NAME_METADATA, profile.getName()); + } + }); return npc.data().get(CACHED_SKIN_UUID_METADATA, reportedUUID); } }