Show alex or steve portrait for offline account

This commit is contained in:
huangyuhui
2018-02-12 21:25:47 +08:00
parent 6823291eb0
commit f6c95e3095
12 changed files with 79 additions and 30 deletions

View File

@@ -20,6 +20,7 @@ package org.jackhuang.hmcl.auth;
import java.net.Proxy;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
*
@@ -32,6 +33,11 @@ public abstract class Account {
*/
public abstract String getUsername();
/**
* @return the UUID
*/
public abstract UUID getUUID();
/**
* log in.
* @param selector selects a character

View File

@@ -20,10 +20,12 @@ package org.jackhuang.hmcl.auth;
import org.jackhuang.hmcl.util.Lang;
import org.jackhuang.hmcl.util.Pair;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.UUIDTypeAdapter;
import java.net.Proxy;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
/**
*
@@ -45,8 +47,8 @@ public class OfflineAccount extends Account {
throw new IllegalArgumentException("Username cannot be blank");
}
public String getUuid() {
return uuid;
public UUID getUUID() {
return UUIDTypeAdapter.fromString(uuid);
}
@Override

View File

@@ -244,6 +244,13 @@ public final class YggdrasilAccount extends Account {
}
}
public UUID getUUID() {
if (getSelectedProfile() == null)
return null;
else
return getSelectedProfile().getId();
}
public Optional<ProfileTexture> getSkin(GameProfile profile) throws IOException, JsonParseException {
if (StringUtils.isBlank(userId))
throw new IllegalStateException("Not logged in");