diff --git a/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index 90ec802e..eaddecb5 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -2,6 +2,7 @@ package me.libraryaddict.disguise.disguisetypes; import java.util.UUID; +import org.apache.commons.lang.Validate; import org.bukkit.entity.Player; import com.comphenix.protocol.wrappers.WrappedGameProfile; @@ -82,12 +83,6 @@ public class PlayerDisguise extends TargetedDisguise { return true; } - @Deprecated - public void setGameProfile(WrappedGameProfile gameProfile) { - this.gameProfile = ReflectionManager.getGameProfileWithThisSkin( - gameProfile.getId() != null ? UUID.fromString(gameProfile.getId()) : null, getName(), gameProfile); - } - @Deprecated public void setSkin(String skinToUse) { this.skinToUse = skinToUse; @@ -104,7 +99,7 @@ public class PlayerDisguise extends TargetedDisguise { @Override public void onLookup(WrappedGameProfile gameProfile) { if (currentLookup == this && gameProfile != null) { - setGameProfile(gameProfile); + setSkin(gameProfile); if (DisguiseUtilities.isDisguiseInUse(PlayerDisguise.this)) { DisguiseUtilities.refreshTrackers(PlayerDisguise.this); if (getEntity() instanceof Player && isSelfDisguiseVisible()) { @@ -116,10 +111,31 @@ public class PlayerDisguise extends TargetedDisguise { }; WrappedGameProfile obj = DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup); if (obj != null) { - setGameProfile(obj); + setSkin(obj); } } } } + /** + * Set the GameProfile, without tampering. + * + * @param gameProfile + * GameProfile + */ + @Deprecated + public void setSkin(WrappedGameProfile gameProfile) { + if (gameProfile == null) { + this.gameProfile = null; + this.skinToUse = null; + return; + } + + Validate.notEmpty(gameProfile.getName(), "Name must be set"); + this.skinToUse = gameProfile.getName(); + this.gameProfile = ReflectionManager.getGameProfileWithThisSkin( + gameProfile.getId() != null ? UUID.fromString(gameProfile.getId()) : null, getName(), gameProfile); + + } + } \ No newline at end of file