Solved Getting the value of a custom head

Discussion in 'Spigot Plugin Development' started by Hello1231, Mar 23, 2020.

  1. So I'm trying to check if two custom heads have the texture, but I can't figure out how to get the value/id of their texture.
  2. Just like setting the texture but in reverse. (You should find a lot of threads about that)
    • Useful Useful x 1
  3. Thanks, that worked. Here's the code if anybody else is looking for it:
    Code (Java):
    public static String getSkullValue(ItemStack head)
            if (head.getType() != Material.PLAYER_HEAD) return null;
            SkullMeta headMeta = (SkullMeta) head.getItemMeta();
            String url = null;
                    Field profileField = headMeta.getClass().getDeclaredField("profile");
                    GameProfile profile = (GameProfile) profileField.get(headMeta);
                    Collection<Property> properties = profile.getProperties().get("textures");
                    for(Property property : properties) {
                        url = property.getValue();
                catch (IllegalArgumentException|NoSuchFieldException|SecurityException | IllegalAccessException error)
                return url;
    • Like Like x 1
    • Friendly Friendly x 1