Solved (1.9) Player Skulls

Discussion in 'Spigot Plugin Development' started by MaxNatural, May 29, 2016.

Thread Status:
Not open for further replies.
  1. Whenever I try to spawn a skull the skin doesn't render in the inventory or on the head but if I place it, it gives the skin.

    Code (Text):
           
            ItemStack mSkull = new ItemStack(Material.SKULL_ITEM, 1, (byte)SkullType.PLAYER.ordinal());
            SkullMeta msMeta = (SkullMeta)mSkull.getItemMeta();
            msMeta.setOwner("Notch");
            msMeta.setDisplayName(ChatColor.GREEN + "" + ChatColor.BOLD + "Notch' Head");
            List<String> msLore = new ArrayList<String>();
            msLore.add(ChatColor.GRAY + "" + ChatColor.ITALIC + "Notchs head");
            msMeta.setLore(msLore);
            mSkull.setItemMeta(msMeta);
    Thank you in advanced :)
     
  2. use this
    Code (Java):
    ItemStack mSkull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
     
    • Optimistic Optimistic x 1
  3. Still a Alex skin :/

    Code (Text):
            ItemStack mSkull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
            SkullMeta msMeta = (SkullMeta)mSkull.getItemMeta();
            msMeta.setOwner("Notch");
            msMeta.setDisplayName(ChatColor.GREEN + "" + ChatColor.BOLD + "Notch");
            List<String> msLore = new ArrayList<String>();
            msLore.add(ChatColor.GRAY + "" + ChatColor.ITALIC + "Notch");
            msMeta.setLore(msLore);
            mSkull.setItemMeta(msMeta);
     
  4. are you in online mode ?
     
  5. Yes
     
  6. when you are giving this itemstack to player inventory, are you updating the playerinventory ?
     
  7. Do not use this method. OP, yours was the correct. Max's will work, but will not be version compatible if Minecraft ever changes the data bytes for player heads.

    I've seen quite a few threads on this topic today, there might be an issue with the latest build of Spigot regarding heads.
     
  8. Indeed. but I don't see any plugin rendering player's head when giving it to them (PlayerInventory).
     
  9. This has been here for a long time. There's lots of threads about this. Since there have been UUIDs, skulls saved the skin url, instead of the client having to figure out the owner's skin. If you look up threads like this, you will find your answer
     
  10. I've been looking for hours and still can't find any solutions. If I could use UUID's how would I set the skull to a UUID?
     
  11. Code (Java):
    meta.setOwner(Bukkit.getServer().getOfflinePlayer("Notch").getUniqueId().toString());
     
  12. @MadMaxCookie just because you can convert the uuid to a string it doesn't mean it will work.

    @MaxNatural Hrm, I couldn't find something specific, but I do have something like that in my plugin AnimatedMenu which is open-source.
    Look a bit around in the Skull class.
     
  13. nothing just a guess.
     
Thread Status:
Not open for further replies.