fix custom heads for 1.21.9

This commit is contained in:
rockyhawk64 2025-10-01 20:07:42 +10:00
parent bb53fddbd2
commit ce8c0de259
3 changed files with 8 additions and 7 deletions

View File

@ -111,7 +111,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.8-R0.1-SNAPSHOT</version>
<version>1.21.9-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

View File

@ -1,6 +1,6 @@
name: CommandPanels
version: 4.0.11
api-version: 1.21.8
api-version: 1.21.9
main: me.rockyhawk.commandpanels.CommandPanels
description: Fully Custom Interactive GUIs with Animations and Logic.

View File

@ -1,5 +1,6 @@
package me.rockyhawk.commandpanels.builder.inventory.items.utils;
import com.destroystokyo.paper.profile.PlayerProfile;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.bukkit.Bukkit;
@ -7,7 +8,6 @@ import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.profile.PlayerProfile;
import org.bukkit.profile.PlayerTextures;
import java.net.MalformedURLException;
@ -26,7 +26,7 @@ public class CustomHeads {
ItemStack skull = new ItemStack(Material.PLAYER_HEAD, 1);
if (!(skull.getItemMeta() instanceof SkullMeta skullMeta)) return skull;
skullMeta.setOwnerProfile(profile);
skullMeta.setPlayerProfile(profile);
skull.setItemMeta(skullMeta);
return skull; // New item each time, only shares profile (skin)
@ -35,13 +35,14 @@ public class CustomHeads {
public ItemStack getPlayerHead(String playerName) {
PlayerProfile profile = profileCache.computeIfAbsent(playerName, key -> {
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerName);
return Bukkit.createPlayerProfile(offlinePlayer.getUniqueId());
return offlinePlayer.getPlayerProfile();
});
ItemStack skull = new ItemStack(Material.PLAYER_HEAD, 1);
if (!(skull.getItemMeta() instanceof SkullMeta skullMeta)) return skull;
skullMeta.setOwnerProfile(profile);
skullMeta.setPlayerProfile(profile);
skull.setItemMeta(skullMeta);
return skull;
@ -53,7 +54,7 @@ public class CustomHeads {
if (skinUrl == null) return null;
try {
PlayerProfile profile = Bukkit.createPlayerProfile(UUID.randomUUID());
PlayerProfile profile = Bukkit.createProfile(UUID.randomUUID());
PlayerTextures textures = profile.getTextures();
textures.setSkin(new URL(skinUrl));
profile.setTextures(textures);