Cache session profile response. Closes #280
This commit is contained in:
@@ -298,10 +298,17 @@ public class YggdrasilAccount extends Account {
|
|||||||
if (StringUtils.isBlank(userId))
|
if (StringUtils.isBlank(userId))
|
||||||
throw new IllegalStateException("Not logged in");
|
throw new IllegalStateException("Not logged in");
|
||||||
|
|
||||||
|
Property textureProperty;
|
||||||
|
|
||||||
|
if (getUserProperties().containsKey("textures"))
|
||||||
|
textureProperty = getUserProperties().get("textures");
|
||||||
|
else {
|
||||||
ProfileResponse response = GSON.fromJson(NetworkUtils.doGet(NetworkUtils.toURL(baseProfile + UUIDTypeAdapter.fromUUID(profile.getId()))), ProfileResponse.class);
|
ProfileResponse response = GSON.fromJson(NetworkUtils.doGet(NetworkUtils.toURL(baseProfile + UUIDTypeAdapter.fromUUID(profile.getId()))), ProfileResponse.class);
|
||||||
if (response.getProperties() == null) return Optional.empty();
|
if (response.getProperties() == null) return Optional.empty();
|
||||||
Property textureProperty = response.getProperties().get("textures");
|
textureProperty = response.getProperties().get("textures");
|
||||||
if (textureProperty == null) return Optional.empty();
|
if (textureProperty == null) return Optional.empty();
|
||||||
|
getUserProperties().putAll(response.getProperties());
|
||||||
|
}
|
||||||
|
|
||||||
TextureResponse texture;
|
TextureResponse texture;
|
||||||
String json = new String(Base64.getDecoder().decode(textureProperty.getValue()), Charsets.UTF_8);
|
String json = new String(Base64.getDecoder().decode(textureProperty.getValue()), Charsets.UTF_8);
|
||||||
|
|||||||
Reference in New Issue
Block a user