clear cached skin records when refrshing account state
This commit is contained in:
@@ -150,6 +150,8 @@ public final class AccountHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void downloadSkin(YggdrasilAccount account, GameProfile profile, boolean refresh, Proxy proxy) throws Exception {
|
private static void downloadSkin(YggdrasilAccount account, GameProfile profile, boolean refresh, Proxy proxy) throws Exception {
|
||||||
|
account.clearCache();
|
||||||
|
|
||||||
if (profile == null) return;
|
if (profile == null) return;
|
||||||
String name = profile.getName();
|
String name = profile.getName();
|
||||||
if (name == null) return;
|
if (name == null) return;
|
||||||
|
|||||||
@@ -91,4 +91,6 @@ public abstract class Account {
|
|||||||
public final Map<Object, Object> getProperties() {
|
public final Map<Object, Object> getProperties() {
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract void clearCache();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,11 @@ public class OfflineAccount extends Account {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearCache() {
|
||||||
|
// Nothing to clear.
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "OfflineAccount[username=" + username + ", uuid=" + uuid + "]";
|
return "OfflineAccount[username=" + username + ", uuid=" + uuid + "]";
|
||||||
|
|||||||
@@ -319,6 +319,13 @@ public class YggdrasilAccount extends Account {
|
|||||||
return Optional.ofNullable(texture.getTextures().get(ProfileTexture.Type.SKIN));
|
return Optional.ofNullable(texture.getTextures().get(ProfileTexture.Type.SKIN));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearCache() {
|
||||||
|
Optional.ofNullable(getSelectedProfile())
|
||||||
|
.map(GameProfile::getProperties)
|
||||||
|
.ifPresent(it -> it.remove("texture"));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "YggdrasilAccount[username=" + getUsername() + "]";
|
return "YggdrasilAccount[username=" + getUsername() + "]";
|
||||||
|
|||||||
Reference in New Issue
Block a user