public interface SkullHandler
Handler interface for setting and getting skull textures. Different implementations are used based on the Bukkit version: - NewSkullHandler for 1.18+ with PlayerProfile API - OldSkullHandler for older versions with GameProfile/reflection - PaperSkullHandler for servers with PaperMC's PlayerProfile API

Provides methods to set skull textures via various sources: player names, UUIDs, texture URLs, Mojang hashes, or Base64 data.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Pattern
    Pattern for Base64 encoded texture data https://github.com/CryptoMorin/XSeries/blob/b11b176deca55da6d465e67a3d4be548c3ef06c6/src/main/java/com/cryptomorin/xseries/profiles/objects/ProfileInputType.java
    static final Pattern
    Pattern for Mojang SHA256 texture hashes https://github.com/CryptoMorin/XSeries/blob/b633d00608435701f1045a566b98a81edd5f923c/src/main/java/com/cryptomorin/xseries/profiles/objects/ProfileInputType.java
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the instance of SkullHandler.
    getSkullValue(org.bukkit.inventory.meta.SkullMeta meta)
    Retrieves the skull texture value (URL or Base64 data) from SkullMeta.
    default void
    setSkull(org.bukkit.inventory.meta.SkullMeta meta, String value)
    Sets skull texture using a string value that can be in multiple formats.
    void
    setSkullByBase64(org.bukkit.inventory.meta.SkullMeta meta, String base64)
    Sets skull texture using Base64 encoded texture data.
    default void
    setSkullByName(org.bukkit.inventory.meta.SkullMeta meta, String name)
    Sets skull texture using a player name.
    void
    setSkullByPlayer(org.bukkit.inventory.meta.SkullMeta meta, org.bukkit.OfflinePlayer player)
    Sets skull texture using an OfflinePlayer.
    default void
    setSkullByURL(org.bukkit.inventory.meta.SkullMeta meta, String url)
    Sets skull texture using a URL string.
    void
    setSkullByURL(org.bukkit.inventory.meta.SkullMeta meta, URL url)
    Sets skull texture using a URL.
    default void
    setSkullByUUID(org.bukkit.inventory.meta.SkullMeta meta, UUID uuid)
    Sets skull texture using a player UUID.
  • Field Details

    • MOJANG_SHA256_APPROX_PATTERN

      static final Pattern MOJANG_SHA256_APPROX_PATTERN
      Pattern for Mojang SHA256 texture hashes https://github.com/CryptoMorin/XSeries/blob/b633d00608435701f1045a566b98a81edd5f923c/src/main/java/com/cryptomorin/xseries/profiles/objects/ProfileInputType.java
    • BASE64_PATTERN

      static final Pattern BASE64_PATTERN
      Pattern for Base64 encoded texture data https://github.com/CryptoMorin/XSeries/blob/b11b176deca55da6d465e67a3d4be548c3ef06c6/src/main/java/com/cryptomorin/xseries/profiles/objects/ProfileInputType.java
  • Method Details

    • getInstance

      static SkullHandler getInstance()
      Gets the instance of SkullHandler.
      Returns:
      the instance
    • setSkullByName

      default void setSkullByName(org.bukkit.inventory.meta.SkullMeta meta, String name)
      Sets skull texture using a player name. Uses Bukkit's OfflinePlayer lookup mechanism.
      Parameters:
      meta - the SkullMeta to modify
      name - the player name
    • setSkullByUUID

      default void setSkullByUUID(org.bukkit.inventory.meta.SkullMeta meta, UUID uuid)
      Sets skull texture using a player UUID. Uses Bukkit's OfflinePlayer lookup mechanism.
      Parameters:
      meta - the SkullMeta to modify
      uuid - the player UUID
    • setSkullByPlayer

      void setSkullByPlayer(org.bukkit.inventory.meta.SkullMeta meta, org.bukkit.OfflinePlayer player)
      Sets skull texture using an OfflinePlayer. This is the most direct method.
      Parameters:
      meta - the SkullMeta to modify
      player - the OfflinePlayer
    • setSkullByURL

      void setSkullByURL(org.bukkit.inventory.meta.SkullMeta meta, URL url)
      Sets skull texture using a URL. The URL should point to a texture PNG image.
      Parameters:
      meta - the SkullMeta to modify
      url - the texture URL
    • setSkullByURL

      default void setSkullByURL(org.bukkit.inventory.meta.SkullMeta meta, String url)
      Sets skull texture using a URL string. The URL string is converted to a URL object.
      Parameters:
      meta - the SkullMeta to modify
      url - the texture URL as a string
      Throws:
      RuntimeException - if the URL string is invalid
    • setSkullByBase64

      void setSkullByBase64(org.bukkit.inventory.meta.SkullMeta meta, String base64)
      Sets skull texture using Base64 encoded texture data. The data should be a Base64-encoded JSON string containing texture information.
      Parameters:
      meta - the SkullMeta to modify
      base64 - the Base64-encoded texture data
    • setSkull

      default void setSkull(org.bukkit.inventory.meta.SkullMeta meta, String value)
      Sets skull texture using a string value that can be in multiple formats. Attempts to parse the value in the following order:
      1. As a texture URL
      2. As a Mojang SHA256 texture hash
      3. As Base64-encoded texture data
      4. As a player UUID
      5. As a player name (default fallback)
      Parameters:
      meta - the SkullMeta to modify
      value - the skull texture value in any of the supported formats
    • getSkullValue

      String getSkullValue(org.bukkit.inventory.meta.SkullMeta meta)
      Retrieves the skull texture value (URL or Base64 data) from SkullMeta.
      Parameters:
      meta - the SkullMeta to query
      Returns:
      the skull texture value as a string, or empty if not found