mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Null check for player textures in GameProfile
Fixes an issue with the ZNPCs plugin.
This commit is contained in:
parent
4da3edd02c
commit
66819aee83
1 changed files with 18 additions and 10 deletions
|
@ -240,7 +240,12 @@ public class SkinManager {
|
|||
// Likely offline mode
|
||||
return loadBedrockOrOfflineSkin(profile);
|
||||
}
|
||||
return loadFromJson(skinProperty.getValue());
|
||||
GameProfileData data = loadFromJson(skinProperty.getValue());
|
||||
if (data != null) {
|
||||
return data;
|
||||
} else {
|
||||
return loadBedrockOrOfflineSkin(profile);
|
||||
}
|
||||
} catch (IOException exception) {
|
||||
GeyserImpl.getInstance().getLogger().debug("Something went wrong while processing skin for " + profile.getName());
|
||||
if (GeyserImpl.getInstance().getConfig().isDebugMode()) {
|
||||
|
@ -254,6 +259,7 @@ public class SkinManager {
|
|||
JsonNode skinObject = GeyserImpl.JSON_MAPPER.readTree(new String(Base64.getDecoder().decode(encodedJson), StandardCharsets.UTF_8));
|
||||
JsonNode textures = skinObject.get("textures");
|
||||
|
||||
if (textures != null) {
|
||||
JsonNode skinTexture = textures.get("SKIN");
|
||||
String skinUrl = skinTexture.get("url").asText().replace("http://", "https://");
|
||||
|
||||
|
@ -267,6 +273,8 @@ public class SkinManager {
|
|||
|
||||
return new GameProfileData(skinUrl, capeUrl, isAlex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return default skin with default cape when texture data is invalid, or the Bedrock player's skin if this
|
||||
|
|
Loading…
Reference in a new issue