mirror of
https://github.com/TotalFreedomMC/TF-LibsDisguises.git
synced 2024-11-11 01:17:16 +00:00
Fixed the disguises fetching player skins before its even used
This commit is contained in:
parent
2102272aae
commit
2a20013de5
1 changed files with 27 additions and 19 deletions
|
@ -237,6 +237,33 @@ public class PlayerDisguise extends TargetedDisguise {
|
||||||
return (PlayerDisguise) super.setReplaceSounds(areSoundsReplaced);
|
return (PlayerDisguise) super.setReplaceSounds(areSoundsReplaced);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean startDisguise() {
|
||||||
|
if (isDisguiseInUse() || skinToUse == null)
|
||||||
|
return super.startDisguise();
|
||||||
|
|
||||||
|
currentLookup = new LibsProfileLookup() {
|
||||||
|
@Override
|
||||||
|
public void onLookup(WrappedGameProfile gameProfile) {
|
||||||
|
if (currentLookup != this || gameProfile == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
setSkin(gameProfile);
|
||||||
|
|
||||||
|
currentLookup = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
WrappedGameProfile gameProfile = DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup,
|
||||||
|
LibsDisguises.getInstance().getConfig().getBoolean("ContactMojangServers", true));
|
||||||
|
|
||||||
|
if (gameProfile != null) {
|
||||||
|
setSkin(gameProfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.startDisguise();
|
||||||
|
}
|
||||||
|
|
||||||
public PlayerDisguise setSkin(String newSkin) {
|
public PlayerDisguise setSkin(String newSkin) {
|
||||||
if (newSkin != null && newSkin.length() > 50) {
|
if (newSkin != null && newSkin.length() > 50) {
|
||||||
try {
|
try {
|
||||||
|
@ -258,25 +285,6 @@ public class PlayerDisguise extends TargetedDisguise {
|
||||||
if (newSkin.length() > 16) {
|
if (newSkin.length() > 16) {
|
||||||
skinToUse = newSkin.substring(0, 16);
|
skinToUse = newSkin.substring(0, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentLookup = new LibsProfileLookup() {
|
|
||||||
@Override
|
|
||||||
public void onLookup(WrappedGameProfile gameProfile) {
|
|
||||||
if (currentLookup != this || gameProfile == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
setSkin(gameProfile);
|
|
||||||
|
|
||||||
currentLookup = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
WrappedGameProfile gameProfile = DisguiseUtilities.getProfileFromMojang(this.skinToUse, currentLookup,
|
|
||||||
LibsDisguises.getInstance().getConfig().getBoolean("ContactMojangServers", true));
|
|
||||||
|
|
||||||
if (gameProfile != null) {
|
|
||||||
setSkin(gameProfile);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue