1.12.2 Paper get player skull

Discussion in 'Spigot Plugin Development' started by LetsHacks, Jan 26, 2020.

  1. Hello everyone,

    so what I want to do is basically getting a skull of a player (name or uuid, but doesnt matter).

    This is the method how i get the skullowner:
    Code (Java):
    public ItemAPI setSkullOwner(UUID uuid) {
            SkullMeta meta = (SkullMeta) this.item.getItemMeta();
            return this;
    And to get the whole itemstack:

    Code (Java):
    new ItemAPI(Material.SKULL_ITEM, 1, (short) 3).setSkullOwner(player.getUniqueId()).setDisplayname("ยง6Player").build())
    But however, the skull has just a normal steve skin :(

    Thanks for your help!
  2. you need to use SetItemMeta afterword or else you are just editing a clone of the original itemstack.

    before "return this;"
    Code (Text):
  3. This will be done by #build();
  4. Try to create the Skull with following code
    Code (Text):

    ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
    And then do the .setOwner and all the other stuff
    • Agree Agree x 1