diff --git a/dough-api/pom.xml b/dough-api/pom.xml index 2bda0eb9..1690ac20 100644 --- a/dough-api/pom.xml +++ b/dough-api/pom.xml @@ -247,7 +247,7 @@ com.mojang authlib - 1.5.25 + 6.0.52 provided diff --git a/dough-skins/pom.xml b/dough-skins/pom.xml index c31660dd..111e36f0 100644 --- a/dough-skins/pom.xml +++ b/dough-skins/pom.xml @@ -38,7 +38,7 @@ com.mojang authlib - 1.5.25 + 6.0.52 provided 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 8fc6f0e8..8dd84703 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 @@ -6,6 +6,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +import com.mojang.authlib.properties.PropertyMap; import org.bukkit.Bukkit; import org.bukkit.inventory.meta.SkullMeta; @@ -45,22 +46,24 @@ public final class CustomGameProfile extends GameProfile { } void apply(@Nonnull SkullMeta meta) throws NoSuchFieldException, IllegalAccessException, UnknownServerVersionException { - ReflectionUtils.setFieldValue(meta, "profile", this); // Forces SkullMeta to properly deserialize and serialize the profile // setOwnerProfile was added in 1.18, but setOwningPlayer throws a NullPointerException since 1.20.2 if (MinecraftVersion.get().isAtLeast(MinecraftVersion.parse("1.20"))) { - PlayerProfile playerProfile = Bukkit.createPlayerProfile(meta.getOwningPlayer().getUniqueId(), PLAYER_NAME); + PlayerProfile playerProfile = Bukkit.createPlayerProfile(UUID.randomUUID(), PLAYER_NAME); PlayerTextures playerTextures = playerProfile.getTextures(); playerTextures.setSkin(this.skinUrl); playerProfile.setTextures(playerTextures); meta.setOwnerProfile(playerProfile); } else { + ReflectionUtils.setFieldValue(meta, "profile", this); + meta.setOwningPlayer(meta.getOwningPlayer()); + + // Now override the texture again + ReflectionUtils.setFieldValue(meta, "profile", this); } - // Now override the texture again - ReflectionUtils.setFieldValue(meta, "profile", this); } /** diff --git a/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/PlayerSkin.java b/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/PlayerSkin.java index 25eb843a..a1b97a64 100644 --- a/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/PlayerSkin.java +++ b/dough-skins/src/main/java/io/github/bakedlibs/dough/skins/PlayerSkin.java @@ -25,7 +25,7 @@ import io.github.bakedlibs.dough.common.DoughLogger; -public final class PlayerSkin { +public class PlayerSkin { private static final String ERROR_TOKEN = "error";