java.lang.Object
tech.guilhermekaua.spigotboot.core.spigot.utils.HeadUtils

public final class HeadUtils extends Object
  • Method Details

    • getHeadByName

      public static org.bukkit.inventory.ItemStack getHeadByName(String name)
    • getHeadByUuid

      public static org.bukkit.inventory.ItemStack getHeadByUuid(UUID uuid)
    • getHeadByUrl

      public static org.bukkit.inventory.ItemStack getHeadByUrl(String url)
      Builds a player head skinned from a Mojang texture URL (e.g. http://textures.minecraft.net/texture/<hash>), replacing the removed NBTEditor.getHead(url) dependency.

      The texture is applied version-proof from 1.8.8 to the latest release via two tiers, both invoked reflectively so this stays compilable under the 1.8.8 signature check and safe at runtime on servers where a given API is absent:

      1. 1.18.1+: the public Bukkit PlayerProfile API (Bukkit.createPlayerProfilePlayerTextures.setSkin(URL)SkullMeta.setOwnerProfile). This survives the 1.20.5 internal GameProfile → ResolvableProfile refactor because it never touches internals.
      2. 1.8-1.17.x: reflection into the skull meta's private profile field with a com.mojang.authlib.GameProfile carrying a base64 textures property.

      A null, blank, or malformed URL yields a bare (owner-less) player head rather than throwing, so a GUI never fails to render.

      Parameters:
      url - the Mojang texture URL, or null/blank for a bare head
      Returns:
      a player-head ItemStack
    • isTextureUrl

      public static boolean isTextureUrl(String value)
      Returns whether value is a Mojang texture URL of the form http(s)://textures.minecraft.net/texture/<hash> (leading/trailing whitespace ignored; host match is case-insensitive).
      Parameters:
      value - the candidate string, or null
      Returns:
      true when value looks like a texture URL with a non-empty hash