diff --git a/platform/platform-bukkit/src/main/java/taboolib/library/xseries/XSkull.java b/platform/platform-bukkit/src/main/java/taboolib/library/xseries/XSkull.java index dc6e54287..1e482526b 100644 --- a/platform/platform-bukkit/src/main/java/taboolib/library/xseries/XSkull.java +++ b/platform/platform-bukkit/src/main/java/taboolib/library/xseries/XSkull.java @@ -277,24 +277,18 @@ private static boolean isBase64(@NotNull String base64) { @Nullable public static ItemBuilder.SkullTexture getSkinValue(@NotNull ItemMeta skull) { - Objects.requireNonNull(skull, "Skull ItemStack cannot be null"); - SkullMeta meta = (SkullMeta) skull; GameProfile profile = null; - try { - profile = (GameProfile) CRAFT_META_SKULL_PROFILE_GETTER.invoke(meta); - } catch (Throwable ex) { - ex.printStackTrace(); + profile = Reflex.Companion.getProperty(skull, "profile", false, true, true); + } catch (Exception ignored) { } - if (profile != null && !profile.getProperties().get("textures").isEmpty()) { for (Property property : profile.getProperties().get("textures")) { if (!property.getValue().isEmpty()) { - return new ItemBuilder.SkullTexture(property.getValue(), null); + return new ItemBuilder.SkullTexture(property.getValue(), profile.getId()); } } } - return null; } diff --git a/platform/platform-bukkit/src/main/kotlin/taboolib/platform/util/ItemBuilder.kt b/platform/platform-bukkit/src/main/kotlin/taboolib/platform/util/ItemBuilder.kt index 10dbb8457..7749df453 100644 --- a/platform/platform-bukkit/src/main/kotlin/taboolib/platform/util/ItemBuilder.kt +++ b/platform/platform-bukkit/src/main/kotlin/taboolib/platform/util/ItemBuilder.kt @@ -84,7 +84,7 @@ fun buildItem(material: Material, builder: ItemBuilder.() -> Unit = {}): ItemSta @Isolated open class ItemBuilder { - class SkullTexture(val textures: String, val uuid: UUID? = UUID.randomUUID()) + class SkullTexture(val textures: String, val uuid: UUID) /** * 物品材质