custom head

Discussion in 'Spigot Plugin Development' started by Karmelek010, Jun 26, 2021.

  1. 1. Dont mark this as a resource if your asking something.
    2. I think your screenshot doesnt load. At least at me I have got no image.
  2. As Mxrlin1 said, don't post this as a resource, it is not a developer tool, it is a question. But to answer your question, you need to use the provided base64 encoded string of the skin and apply it to a player skull. I talk about this exact thing in this post. You can find the base64 encoded string for the skin you want under the other section and the value field. For example the base64 encoded string of the skin you want is this:

  3. It's not a screenshot, it is a link to a website with a list of minecraft skins
    • Friendly Friendly x 1
  4. i know this shit is considered spoonfeeding but whatever fuck it lol.

    Code (Java):
    public static ItemStack getHead(Player player) {
            int lifePlayer = (int) player.getHealth();
            ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
            SkullMeta skull = (SkullMeta) item.getItemMeta();
            ArrayList<String> lore = new ArrayList<String>();
            lore.add("Custom head");
            return item;
  5. He is asking how to apply a skin to a player skull without a player name. The website he provided does not have player names. So sadly that method would not work.
  6. You can use this method
    Code (Text):
    public static ItemStack getSkull(String url) {
           ItemStack item = new ItemStack(Material.PLAYER_HEAD);
            if(url.isEmpty())return item;
            SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
            GameProfile profile = new GameProfile(UUID.randomUUID(), null);
            byte[] encodedData = Base64.getEncoder().encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes());
            profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
            Field profileField = null;
                profileField = itemMeta.getClass().getDeclaredField("profile");
                profileField.set(itemMeta, profile);
            catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e)
            return item;
  7. I already sent a perfectly fine working method in the first reply