Class HeadCreator

java.lang.Object
valorless.rarespawns.utils.HeadCreator

public class HeadCreator extends Object
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
Uses the standard Mojang textures JSON structure: {"textures":{"SKIN":{"url":"..."}}}.

  • 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

      public static org.bukkit.inventory.ItemStack itemFromUuid(UUID id)
      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

      public static String extractUrlFromBase64(String base64Texture)
      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

      public static String convertUrlToBase64(String textureUrl)
      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":"..."}}}