From e89008cf97c4f4c077d0ffcb972474c059915d6a Mon Sep 17 00:00:00 2001 From: Auxilor Date: Mon, 1 Nov 2021 16:00:38 +0000 Subject: [PATCH] Fixed SkullUtils#getSkullTexture --- .../src/main/kotlin/com/willfp/eco/proxy/v1_16_R3/Skull.kt | 7 ++++--- .../src/main/kotlin/com/willfp/eco/proxy/v1_17_R1/Skull.kt | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/eco-core/core-nms/v1_16_R3/src/main/kotlin/com/willfp/eco/proxy/v1_16_R3/Skull.kt b/eco-core/core-nms/v1_16_R3/src/main/kotlin/com/willfp/eco/proxy/v1_16_R3/Skull.kt index c59c27f7..5e98ce71 100644 --- a/eco-core/core-nms/v1_16_R3/src/main/kotlin/com/willfp/eco/proxy/v1_16_R3/Skull.kt +++ b/eco-core/core-nms/v1_16_R3/src/main/kotlin/com/willfp/eco/proxy/v1_16_R3/Skull.kt @@ -36,8 +36,9 @@ class Skull : SkullProxy { profile = meta.javaClass.getDeclaredField("profile") profile.isAccessible = true } - val profile = profile[meta] as GameProfile? - val property = profile?.properties?.get("textures") as Property? - return property?.value + val profile = profile[meta] as GameProfile? ?: return null + val properties = profile.properties ?: return null + val prop = properties["textures"] ?: return null + return prop.toMutableList().firstOrNull()?.name } } \ No newline at end of file diff --git a/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/eco/proxy/v1_17_R1/Skull.kt b/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/eco/proxy/v1_17_R1/Skull.kt index 529ca6b7..287dd70f 100644 --- a/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/eco/proxy/v1_17_R1/Skull.kt +++ b/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/eco/proxy/v1_17_R1/Skull.kt @@ -36,8 +36,9 @@ class Skull : SkullProxy { profile = meta.javaClass.getDeclaredField("profile") profile.isAccessible = true } - val profile = profile[meta] as GameProfile? - val property = profile?.properties?.get("textures") as Property? - return property?.value + val profile = profile[meta] as GameProfile? ?: return null + val properties = profile.properties ?: return null + val prop = properties["textures"] ?: return null + return prop.toMutableList().firstOrNull()?.name } } \ No newline at end of file