Fix request mojang server for skin info every time

This commit is contained in:
huanghongxun
2018-10-11 22:05:24 +08:00
parent b8bd0a08e0
commit 2dc956b357

View File

@@ -140,12 +140,12 @@ public final class AccountHelper {
private static void downloadSkin(YggdrasilAccount account, GameProfile profile, boolean refresh) throws Exception { private static void downloadSkin(YggdrasilAccount account, GameProfile profile, boolean refresh) throws Exception {
account.clearCache(); account.clearCache();
Optional<Texture> texture = account.getSkin(profile);
if (!texture.isPresent()) return;
String url = texture.get().getUrl();
File file = getSkinFile(profile.getId()); File file = getSkinFile(profile.getId());
if (!refresh && file.exists()) if (!refresh && file.exists())
return; return;
Optional<Texture> texture = account.getSkin(profile);
if (!texture.isPresent()) return;
String url = texture.get().getUrl();
new FileDownloadTask(NetworkUtils.toURL(url), file).run(); new FileDownloadTask(NetworkUtils.toURL(url), file).run();
} }
@@ -153,12 +153,12 @@ public final class AccountHelper {
account.clearCache(); account.clearCache();
if (account.getCharacter() == null) return; if (account.getCharacter() == null) return;
Optional<Texture> texture = account.getSkin();
if (!texture.isPresent()) return;
String url = texture.get().getUrl();
File file = getSkinFile(account.getUUID()); File file = getSkinFile(account.getUUID());
if (!refresh && file.exists()) if (!refresh && file.exists())
return; return;
Optional<Texture> texture = account.getSkin();
if (!texture.isPresent()) return;
String url = texture.get().getUrl();
new FileDownloadTask(NetworkUtils.toURL(url), file).run(); new FileDownloadTask(NetworkUtils.toURL(url), file).run();
} }