Fix outdated code which would make huge problems because of previous fix

This commit is contained in:
libraryaddict 2014-06-01 06:53:01 +12:00
parent 841dab296d
commit 5bfd6c5541
2 changed files with 13 additions and 12 deletions

View File

@ -1,5 +1,7 @@
package me.libraryaddict.disguise.disguisetypes;
import org.bukkit.entity.Player;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.LibsProfileLookup;
import me.libraryaddict.disguise.utilities.ReflectionManager;
@ -58,7 +60,7 @@ public class PlayerDisguise extends TargetedDisguise {
}
return ReflectionManager.getGameProfile(null, getName());
} else {
return DisguiseUtilities.getProfileFromMojang(getName());
return DisguiseUtilities.getProfileFromMojang(this);
}
}
@ -100,6 +102,9 @@ public class PlayerDisguise extends TargetedDisguise {
setGameProfile(gameProfile);
if (DisguiseUtilities.isDisguiseInUse(PlayerDisguise.this)) {
DisguiseUtilities.refreshTrackers(PlayerDisguise.this);
if (getEntity() instanceof Player && isSelfDisguiseVisible()) {
DisguiseUtilities.sendSelfDisguise((Player) getEntity(), PlayerDisguise.this);
}
}
}
}

View File

@ -294,23 +294,19 @@ public class DisguiseUtilities {
return players;
}
public static Object getProfileFromMojang(final String playerName) {
return getProfileFromMojang(playerName, new LibsProfileLookup() {
public static Object getProfileFromMojang(final PlayerDisguise disguise) {
return getProfileFromMojang(disguise.getName(), new LibsProfileLookup() {
@Override
public void onLookup(Object gameProfile) {
getAddedByPlugins().remove(playerName);
for (HashSet<TargetedDisguise> disguises : DisguiseUtilities.getDisguises().values()) {
for (TargetedDisguise disguise : disguises) {
if (disguise.getType() == DisguiseType.PLAYER && ((PlayerDisguise) disguise).getName().equals(playerName)) {
getAddedByPlugins().remove(disguise.getName());
if (DisguiseAPI.isDisguiseInUse(disguise)) {
DisguiseUtilities.refreshTrackers((TargetedDisguise) disguise);
if (disguise.getEntity() instanceof Player && disguise.isSelfDisguiseVisible()) {
DisguiseUtilities.sendSelfDisguise((Player) disguise.getEntity(), disguise);
}
}
}
}
}
});
}