Class SkullUtils
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:
- 7.0.0
- Author:
- Crypto Morin
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final MethodHandleprotected static final MethodHandleprotected static final MethodHandleprotected static final MethodHandlestatic final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.inventory.meta.SkullMetastatic org.bukkit.inventory.meta.SkullMetastatic org.bukkit.inventory.meta.SkullMetaapplySkin(org.bukkit.inventory.meta.ItemMeta head, org.bukkit.OfflinePlayer identifier) static com.mojang.authlib.GameProfiledetectProfileFromString(String identifier) static SkullUtils.StringSkullCachedetectSkullValueType(String identifier) static StringencodeTexturesURL(String url) static StringgetSkinValue(org.bukkit.inventory.meta.ItemMeta skull) static org.bukkit.inventory.ItemStackstatic com.mojang.authlib.GameProfileprofileFromBase64(String base64, String MojangSHA) static com.mojang.authlib.GameProfileprofileFromPlayer(org.bukkit.OfflinePlayer player) static voidsetProfile(org.bukkit.inventory.meta.SkullMeta head, com.mojang.authlib.GameProfile profile) Setting the profile directly is not compatible withSkullMeta.setOwningPlayer(OfflinePlayer)and should be reset withsetProfile(head, null)before anything.static voidstatic voidsetSkin(org.bukkit.block.BlockState state, com.mojang.authlib.GameProfile profile) static voidstatic org.bukkit.inventory.meta.SkullMetasetSkullBase64(org.bukkit.inventory.meta.SkullMeta head, String value, String MojangSHA)
-
Field Details
-
CRAFT_META_SKULL_PROFILE_GETTER
-
CRAFT_META_SKULL_PROFILE_SETTER
-
CRAFT_META_SKULL_BLOCK_SETTER
-
PROPERTY_GETVALUE
-
SUPPORTS_UUID
public static final boolean SUPPORTS_UUID
-
-
Constructor Details
-
SkullUtils
public SkullUtils()
-
-
Method Details
-
getSkull
-
applySkin
-
applySkin
-
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
-
setProfile
public static void setProfile(org.bukkit.inventory.meta.SkullMeta head, com.mojang.authlib.GameProfile profile) Setting the profile directly is not compatible withSkullMeta.setOwningPlayer(OfflinePlayer)and should be reset withsetProfile(head, null)before anything.It seems like the Profile is prioritized over UUID/name.
-
profileFromBase64
-
profileFromPlayer
@Nonnull public static com.mojang.authlib.GameProfile profileFromPlayer(org.bukkit.OfflinePlayer player) -
detectProfileFromString
-
detectSkullValueType
-
setSkin
-
setSkin
-
setSkin
-
encodeTexturesURL
-
getSkinValue
-