Class SkullUtils

java.lang.Object
com.cryptomorin.xseries.SkullUtils

public final class SkullUtils extends Object
SkullUtils - Apply skull texture from different sources.
Skull Meta: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/SkullMeta.html Mojang API: https://wiki.vg/Mojang_API

Some websites to get custom heads:

  • https://minecraft-heads.com/

The basic premise behind this API is that the final skull data is contained in a GameProfile either by ID, name or encoded textures URL property.

Different versions of Minecraft client handle this differently. In newer versions the client seem to prioritize the texture property over the set UUID and name, in older versions however using the same UUID for all GameProfiles caused all skulls (that use base64) to look the same. The client is responsible for caching skull textures. If the download were to fail (either because of connection issues or invalid values) the client will cache that skull UUID and the skull will remain as a steve head until the client is completely restarted. I don't know if this cache system works across other servers or is just specific to one server.

Version:
6.0.1
Author:
Crypto Morin
See Also:
  • Field Details

    • CRAFT_META_SKULL_PROFILE_GETTER

      protected static final MethodHandle CRAFT_META_SKULL_PROFILE_GETTER
    • CRAFT_META_SKULL_PROFILE_SETTER

      protected static final MethodHandle CRAFT_META_SKULL_PROFILE_SETTER
    • CRAFT_META_SKULL_BLOCK_SETTER

      protected static final MethodHandle CRAFT_META_SKULL_BLOCK_SETTER
    • PROPERTY_GETVALUE

      protected static final MethodHandle PROPERTY_GETVALUE
  • Constructor Details

    • SkullUtils

      public SkullUtils()
  • Method Details

    • getSkull

      @Nonnull public static org.bukkit.inventory.ItemStack getSkull(@Nonnull UUID id)
    • applySkin

      @Nonnull public static org.bukkit.inventory.meta.SkullMeta applySkin(@Nonnull org.bukkit.inventory.meta.ItemMeta head, @Nonnull org.bukkit.OfflinePlayer identifier)
    • applySkin

      @Nonnull public static org.bukkit.inventory.meta.SkullMeta applySkin(@Nonnull org.bukkit.inventory.meta.ItemMeta head, @Nonnull UUID identifier)
    • applySkin

      @Nonnull public static org.bukkit.inventory.meta.SkullMeta applySkin(@Nonnull org.bukkit.inventory.meta.ItemMeta head, @Nonnull String identifier)
      Parameters:
      identifier - Can be a player name, player UUID, Base64, or a minecraft.net skin link.
    • setSkullBase64

      @Nonnull public static org.bukkit.inventory.meta.SkullMeta setSkullBase64(@Nonnull org.bukkit.inventory.meta.SkullMeta head, @Nonnull String value, String MojangSHA)
    • setProfile

      public static void setProfile(org.bukkit.inventory.meta.SkullMeta head, com.mojang.authlib.GameProfile profile)
      Setting the profile directly is not compatible with SkullMeta.setOwningPlayer(OfflinePlayer) and should be reset with setProfile(head, null) before anything.

      It seems like the Profile is prioritized over UUID/name.

    • profileFromBase64

      @Nonnull public static com.mojang.authlib.GameProfile profileFromBase64(String base64, String MojangSHA)
    • profileFromPlayer

      @Nonnull public static com.mojang.authlib.GameProfile profileFromPlayer(org.bukkit.OfflinePlayer player)
    • detectProfileFromString

      @Nonnull public static com.mojang.authlib.GameProfile detectProfileFromString(String identifier)
    • detectSkullValueType

      @Nonnull public static com.cryptomorin.xseries.SkullUtils.StringSkullCache detectSkullValueType(@Nonnull String identifier)
    • setSkin

      public static void setSkin(@Nonnull org.bukkit.block.Block block, @Nonnull String value)
    • encodeTexturesURL

      public static String encodeTexturesURL(String url)
    • getSkinValue

      @Nullable public static String getSkinValue(@Nonnull org.bukkit.inventory.meta.ItemMeta skull)