Show alex or steve portrait for offline account
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user