3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 00:00:41 +01:00

Null check for player textures in GameProfile

Fixes an issue with the ZNPCs plugin.
Dieser Commit ist enthalten in:
Camotoy 2021-12-03 19:24:22 -05:00
Ursprung 4da3edd02c
Commit 66819aee83
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -240,7 +240,12 @@ public class SkinManager {
// Likely offline mode // Likely offline mode
return loadBedrockOrOfflineSkin(profile); return loadBedrockOrOfflineSkin(profile);
} }
return loadFromJson(skinProperty.getValue()); GameProfileData data = loadFromJson(skinProperty.getValue());
if (data != null) {
return data;
} else {
return loadBedrockOrOfflineSkin(profile);
}
} catch (IOException exception) { } catch (IOException exception) {
GeyserImpl.getInstance().getLogger().debug("Something went wrong while processing skin for " + profile.getName()); GeyserImpl.getInstance().getLogger().debug("Something went wrong while processing skin for " + profile.getName());
if (GeyserImpl.getInstance().getConfig().isDebugMode()) { if (GeyserImpl.getInstance().getConfig().isDebugMode()) {
@ -254,18 +259,21 @@ public class SkinManager {
JsonNode skinObject = GeyserImpl.JSON_MAPPER.readTree(new String(Base64.getDecoder().decode(encodedJson), StandardCharsets.UTF_8)); JsonNode skinObject = GeyserImpl.JSON_MAPPER.readTree(new String(Base64.getDecoder().decode(encodedJson), StandardCharsets.UTF_8));
JsonNode textures = skinObject.get("textures"); JsonNode textures = skinObject.get("textures");
JsonNode skinTexture = textures.get("SKIN"); if (textures != null) {
String skinUrl = skinTexture.get("url").asText().replace("http://", "https://"); JsonNode skinTexture = textures.get("SKIN");
String skinUrl = skinTexture.get("url").asText().replace("http://", "https://");
boolean isAlex = skinTexture.has("metadata"); boolean isAlex = skinTexture.has("metadata");
String capeUrl = null; String capeUrl = null;
JsonNode capeTexture = textures.get("CAPE"); JsonNode capeTexture = textures.get("CAPE");
if (capeTexture != null) { if (capeTexture != null) {
capeUrl = capeTexture.get("url").asText().replace("http://", "https://"); capeUrl = capeTexture.get("url").asText().replace("http://", "https://");
}
return new GameProfileData(skinUrl, capeUrl, isAlex);
} }
return null;
return new GameProfileData(skinUrl, capeUrl, isAlex);
} }
/** /**