Class HeadUtils
java.lang.Object
tech.guilhermekaua.spigotboot.core.spigot.utils.HeadUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.inventory.ItemStackgetHeadByName(String name) static org.bukkit.inventory.ItemStackgetHeadByUrl(String url) Builds a player head skinned from a Mojang texture URL (e.g.static org.bukkit.inventory.ItemStackgetHeadByUuid(UUID uuid) static booleanisTextureUrl(String value) Returns whethervalueis a Mojang texture URL of the formhttp(s)://textures.minecraft.net/texture/<hash>(leading/trailing whitespace ignored; host match is case-insensitive).
-
Method Details
-
getHeadByName
-
getHeadByUuid
-
getHeadByUrl
Builds a player head skinned from a Mojang texture URL (e.g.http://textures.minecraft.net/texture/<hash>), replacing the removedNBTEditor.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.18.1+: the public Bukkit
PlayerProfileAPI (Bukkit.createPlayerProfile→PlayerTextures.setSkin(URL)→SkullMeta.setOwnerProfile). This survives the 1.20.5 internalGameProfile → ResolvableProfilerefactor because it never touches internals. - 1.8-1.17.x: reflection into the skull meta's private
profilefield with acom.mojang.authlib.GameProfilecarrying 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
- 1.18.1+: the public Bukkit
-
isTextureUrl
Returns whethervalueis a Mojang texture URL of the formhttp(s)://textures.minecraft.net/texture/<hash>(leading/trailing whitespace ignored; host match is case-insensitive).- Parameters:
value- the candidate string, or null- Returns:
truewhenvaluelooks like a texture URL with a non-empty hash
-