Package valorless.rarespawns.utils
Class HeadCreator
java.lang.Object
valorless.rarespawns.utils.HeadCreator
Utilities for creating player head items and converting Mojang skin texture data.
Provides helpers to:
- Create a blank player head item
- Create a player head bound to an owning player UUID
- Convert a textures JSON URL to Base64 and back
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringconvertUrlToBase64(String textureUrl) Encodes a skin texture URL into the Base64-encoded textures JSON structure expected by skull metadata.static org.bukkit.inventory.ItemStackCreates a blank player skull item.static StringextractUrlFromBase64(String base64Texture) Extracts the skin texture URL from a Base64-encoded textures JSON string.static org.bukkit.inventory.ItemStackitemFromUuid(UUID id) Creates a player head ItemStack for the specified player UUID.
-
Method Details
-
createSkull
public static org.bukkit.inventory.ItemStack createSkull()Creates a blank player skull item.- Returns:
- a new ItemStack of type PLAYER_HEAD
-
itemFromUuid
Creates a player head ItemStack for the specified player UUID. The owning player is set on the skull meta to render the player's skin.- Parameters:
id- the UUID of the player whose head texture should be shown- Returns:
- a PLAYER_HEAD ItemStack with the owning player set
-
extractUrlFromBase64
Extracts the skin texture URL from a Base64-encoded textures JSON string.- Parameters:
base64Texture- the Base64 string containing the textures JSON payload- Returns:
- the value of textures.SKIN.url
-
convertUrlToBase64
Encodes a skin texture URL into the Base64-encoded textures JSON structure expected by skull metadata.- Parameters:
textureUrl- the absolute URL of the skin texture- Returns:
- a Base64 string representing {"textures":{"SKIN":{"url":"..."}}}
-