From dfdb12c54c8e8eca08d7cb2ea87391cd62d46dbe Mon Sep 17 00:00:00 2001 From: OmegaApproximasterEthereal2004 Date: Sun, 16 Nov 2025 22:11:23 +0900 Subject: [PATCH 1/2] Update CustomGameProfile.java --- .../dough/skins/CustomGameProfile.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/CustomGameProfile.java b/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/CustomGameProfile.java index 7976a7bb..7a9bd7b4 100644 --- a/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/CustomGameProfile.java +++ b/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/CustomGameProfile.java @@ -33,9 +33,10 @@ public final class CustomGameProfile extends GameProfile { private final URL skinUrl; private final String texture; - - CustomGameProfile(@Nonnull UUID uuid, @Nullable String texture, @Nonnull URL url) { - super(uuid, PLAYER_NAME); + private final GameProfile delegate; + + public CustomGameProfile(@Nonnull UUID uuid, @Nullable String texture, @Nonnull URL url) { + this.delegate = new GameProfile(uuid, PLAYER_NAME); this.skinUrl = url; this.texture = texture; @@ -44,24 +45,22 @@ public final class CustomGameProfile extends GameProfile { } } - void apply(@Nonnull SkullMeta meta) throws NoSuchFieldException, IllegalAccessException, UnknownServerVersionException { - // setOwnerProfile was added in 1.18, but getOwningPlayer throws a NullPointerException since 1.20.2 + public void apply(@Nonnull SkullMeta meta) throws NoSuchFieldException, IllegalAccessException, UnknownServerVersionException { if (MinecraftVersion.get().isAtLeast(MinecraftVersion.parse("1.20"))) { - PlayerProfile playerProfile = Bukkit.createPlayerProfile(this.getId(), PLAYER_NAME); + PlayerProfile playerProfile = Bukkit.createPlayerProfile(this.delegate.getId(), PLAYER_NAME); PlayerTextures playerTextures = playerProfile.getTextures(); playerTextures.setSkin(this.skinUrl); playerProfile.setTextures(playerTextures); meta.setOwnerProfile(playerProfile); } else { - // Forces SkullMeta to properly deserialize and serialize the profile - ReflectionUtils.setFieldValue(meta, "profile", this); + // Force SkullMeta to use our wrapped GameProfile + ReflectionUtils.setFieldValue(meta, "profile", this.delegate); meta.setOwningPlayer(meta.getOwningPlayer()); - // Now override the texture again - ReflectionUtils.setFieldValue(meta, "profile", this); + // Override the texture again + ReflectionUtils.setFieldValue(meta, "profile", this.delegate); } - } /** @@ -73,4 +72,8 @@ void apply(@Nonnull SkullMeta meta) throws NoSuchFieldException, IllegalAccessEx public String getBase64Texture() { return this.texture; } + + public GameProfile getHandle() { + return this.delegate; + } } From ec41e653e3d93a87b4b2a6a7f6c27c219347f7c0 Mon Sep 17 00:00:00 2001 From: OmegaApproximasterEthereal2004 Date: Tue, 18 Nov 2025 22:02:46 +0900 Subject: [PATCH 2/2] Update CustomGameProfile.java --- .../java/io/github/bakedlibs/dough/skins/CustomGameProfile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/CustomGameProfile.java b/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/CustomGameProfile.java index 7a9bd7b4..9e6515f1 100644 --- a/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/CustomGameProfile.java +++ b/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/CustomGameProfile.java @@ -18,7 +18,7 @@ import org.bukkit.profile.PlayerProfile; import org.bukkit.profile.PlayerTextures; -public final class CustomGameProfile extends GameProfile { +public final class CustomGameProfile { /** * The player name for this profile.