Player head not showing skin

Discussion in 'Plugin Development' started by MCMastery, Jul 12, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    MCMastery

    I'm trying to get a player head as an item:
    Code:
        public static ItemStack getPlayerHead(String name) {
            ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
            SkullMeta meta = (SkullMeta) skull.getItemMeta();
            meta.setOwner(name);
            skull.setItemMeta(meta);
            return skull;
        }
    When I do this using "MCMastery", it just displays the default Steve head.
    What am I doing wrong?
     
  2. What version of bukkit is the server running? As far as I know, playerheads will only render in the inventory since 1.8. Versions prior to 1.8 will render as the steve head.
     
  3. Offline

    MCMastery

    1.10
     
  4. Offline

    MCMastery

  5. Don't you have to put in the UUID of a player? Can't test it atm.. on mobile.
     
  6. Offline

    I Al Istannen

    @MCMastery
    I literally used this code in one of my plugins:
    Code:
    .forEach(loopPlayer -> {
                            ItemStack item = ItemStackBuilder
                                    .builder(Material.SKULL_ITEM)
                                    .setDurability((short) 3)
                                    .setName(Util.color("&6" + loopPlayer.getDisplayName()))
                                    .setLore("&3(" + loopPlayer.getName() + ")")
                                    .setSkullOwner(loopPlayer.getName())
                                    .build();
                            guiInv.addItem(integer.getAndIncrement(), new GuiItem(item, GuiItemClickResult.CANCEL));
                    });
    With this setSkullOwner method:
    Code:
        public ItemStackBuilder setSkullOwner(String name) {
            if(item.getType() != Material.SKULL_ITEM) {
                return this;
            }
    
            SkullMeta meta = (SkullMeta) item.getItemMeta();
            meta.setOwner(name);
            item.setItemMeta(meta);
            itemMeta = item.getItemMeta();
           
            return this;
        }
    And it works... Are you on a hosted server by any chance? Does it work on your own computer, with a local server?
     
  7. Offline

    MCMastery

    I'm on a local server (online)
     
  8. Offline

    I Al Istannen

    @MCMastery
    Damn. I though maybe the mojang API temp-banned your hosters IP, but if that isn't the case, I don't really know :/
    Have you tried waiting a few seconds with an open inventory?

    And does using the give command work?
    It is this: "/give @p skull <amount> 3 {SkullOwner:"<PlayerName>"}"
     
  9. Offline

    MCMastery

    The give command works, instantly...
     
  10. Offline

    I Al Istannen

    @MCMastery
    Great... Does adding the skull to your own inventory work? And does it work now in the gui?
     
  11. Offline

    MCMastery

    In my inventory it is fine. In the GUI, it is still Alex's / or Steve's head D:
     
  12. @MCMastery I wonder if it's an update issue, update the inventory and see if it is still a Steve head
     
    I Al Istannen likes this.
  13. Offline

    I Al Istannen

    @bwfcwalshy
    "as it is a temporary work-around for a larger, more complicated issue."
    That was when? A year ago? xD

    But it could actually work. Good idea!
     
  14. Offline

    MCMastery

    It is actually adding the head item to a inventory created using Bukkit.createInventory - but I can try it anyway
     
Thread Status:
Not open for further replies.

Share This Page