The name to fetch is either the skin or name. Not both. Move the runnables down to make it accessible and prevent the invalid names using it

This commit is contained in:
libraryaddict 2014-08-27 04:25:02 +12:00
parent 3173ceec77
commit af9dfb8d6e

View File

@ -337,17 +337,19 @@ public class DisguiseUtilities {
} }
public static WrappedGameProfile getProfileFromMojang(final PlayerDisguise disguise) { public static WrappedGameProfile getProfileFromMojang(final PlayerDisguise disguise) {
final boolean remove = getAddedByPlugins().contains(disguise.getName().toLowerCase()); final String nameToFetch = disguise.getSkin() != null ? disguise.getSkin() : disguise.getName();
return getProfileFromMojang(disguise.getName(), new LibsProfileLookup() { final boolean remove = getAddedByPlugins().contains(nameToFetch.toLowerCase());
return getProfileFromMojang(nameToFetch, new LibsProfileLookup() {
@Override @Override
public void onLookup(WrappedGameProfile gameProfile) { public void onLookup(WrappedGameProfile gameProfile) {
if (remove) { if (remove) {
getAddedByPlugins().remove(disguise.getName().toLowerCase()); getAddedByPlugins().remove(nameToFetch.toLowerCase());
} }
if (DisguiseAPI.isDisguiseInUse(disguise) if (DisguiseAPI.isDisguiseInUse(disguise)
&& (!gameProfile.getName().equals(disguise.getName()) || (LibVersion.is1_7_6() && !gameProfile && (!gameProfile.getName().equals(
.getProperties().isEmpty()))) { disguise.getSkin() != null && LibVersion.is1_7_6() ? disguise.getSkin() : disguise.getName()) || (LibVersion
.is1_7_6() && !gameProfile.getProperties().isEmpty()))) {
// TODO Resend for UUID? Might need to in the future. // TODO Resend for UUID? Might need to in the future.
DisguiseUtilities.refreshTrackers(disguise); DisguiseUtilities.refreshTrackers(disguise);
} }
@ -411,13 +413,15 @@ public class DisguiseUtilities {
} }
} }
}); });
} else {
return ReflectionManager.getGameProfile(null, origName);
}
if (runnable != null) { if (runnable != null) {
if (!runnables.containsKey(playerName)) { if (!runnables.containsKey(playerName)) {
runnables.put(playerName, new ArrayList<Object>()); runnables.put(playerName, new ArrayList<Object>());
} }
runnables.get(playerName).add(runnable); runnables.get(playerName).add(runnable);
} }
}
return ReflectionManager.getGameProfile(null, origName); return ReflectionManager.getGameProfile(null, origName);
} }