From 3866377a28b3a5dcf527e98b24246155668969e1 Mon Sep 17 00:00:00 2001 From: yushijinhun Date: Sat, 2 Jun 2018 18:15:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8UUID=E8=80=8C=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E8=A7=92=E8=89=B2=E5=90=8D=E6=9D=A5=E6=A0=87=E8=AF=86?= =?UTF-8?q?=E7=9A=AE=E8=82=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jackhuang/hmcl/game/AccountHelper.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/AccountHelper.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/AccountHelper.java index 2ed2be5e9..ae4db1045 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/AccountHelper.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/AccountHelper.java @@ -38,6 +38,7 @@ import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.Optional; +import java.util.UUID; public final class AccountHelper { @@ -73,8 +74,8 @@ public final class AccountHelper { return new SkinLoadTask(account, proxy, true); } - private static File getSkinFile(String name) { - return new File(SKIN_DIR, name + ".png"); + private static File getSkinFile(UUID uuid) { + return new File(SKIN_DIR, uuid + ".png"); } public static Image getSkin(YggdrasilAccount account) { @@ -84,7 +85,7 @@ public final class AccountHelper { public static Image getSkin(YggdrasilAccount account, double scaleRatio) { if (account.getCharacter() == null) return getDefaultSkin(account, scaleRatio); - File file = getSkinFile(account.getCharacter()); + File file = getSkinFile(account.getUUID()); if (file.exists()) { Image original = new Image("file:" + file.getAbsolutePath()); return new Image("file:" + file.getAbsolutePath(), @@ -96,8 +97,7 @@ public final class AccountHelper { } public static Image getSkinImmediately(YggdrasilAccount account, GameProfile profile, double scaleRatio, Proxy proxy) throws Exception { - String name = profile.getName(); - File file = getSkinFile(name); + File file = getSkinFile(profile.getId()); downloadSkin(account, profile, true, proxy); if (!file.exists()) return getDefaultSkin(account, scaleRatio); @@ -152,7 +152,7 @@ public final class AccountHelper { Optional texture = account.getSkin(profile); if (!texture.isPresent()) return; String url = texture.get().getUrl(); - File file = getSkinFile(profile.getName()); + File file = getSkinFile(profile.getId()); if (!refresh && file.exists()) return; new FileDownloadTask(NetworkUtils.toURL(url), file, proxy).run(); @@ -165,7 +165,7 @@ public final class AccountHelper { Optional texture = account.getSkin(); if (!texture.isPresent()) return; String url = texture.get().getUrl(); - File file = getSkinFile(account.getCharacter()); + File file = getSkinFile(account.getUUID()); if (!refresh && file.exists()) return; new FileDownloadTask(NetworkUtils.toURL(url), file, proxy).run();