Player Skin not showing up on skulls in inventory

Discussion in 'Plugin Development' started by Machine Maker, Jun 28, 2017.

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

    Machine Maker

    The plugin I am writing will have an inventory of player heads of players on the server. But the skulls in the inventory are all steves, and only when a skull is placed down (which isnt the point of the inventory) does the skin change to the correct player skin. I am using craftbukkit 1.8.8 Here is my code.

    Code:
    Inventory inv = Bukkit.createInventory(null, 54, ChatColor.UNDERLINE + ChatColor.GOLD.toString() + "Active Bounties");
            for (Bounty b : BountyManager.getInstance().getBountyList()) {
                ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
                SkullMeta meta = (SkullMeta) skull.getItemMeta();
                meta.setOwner(b.getTarget().getName());
                meta.setDisplayName(ChatColor.GOLD + b.getTarget().getName());
                List<String> lore = new ArrayList<String>();
                lore.add(ChatColor.LIGHT_PURPLE + "Reward: " + ChatColor.YELLOW + ChatColor.UNDERLINE.toString() + b.getAmount() + ChatColor.RESET + ChatColor.YELLOW + " coins");
                meta.setLore(lore);
                skull.setItemMeta(meta);
                inv.setItem(b.getNumber() - 1, skull);
            }
    Any ideas what I am doing wrong?
     
  2. Offline

    mehboss

    Try updating their inventory p.updateInventory
     
  3. Offline

    Zombie_Striker

    @mehboss
    That does not work. Skin changes are only triggered when an entity (whether it be a real entity or title entity) is added to the world.

    @X1machinemaker1X
    To rephrase what I posted above, a block needs to be added to the world in order for the skins to be applied. All you need to do is place a head at the player's location for a few ticks in order for the skins to load. If you have multiple heads, it best if you just create a row of heads beneath the player, keep it there for a few ticks, and then remove all the heads from the world.
     
  4. Offline

    mehboss

    I didn't need to do that when I made a head plugin. Also, what if his plugin goes public, any "automated" way..?
     
  5. Offline

    Zombie_Striker

    @mehboss
    Well, in that case, you would do the same thing, though you would want to set it someone far from the player (such as the bottom of the world), and reset those blocks after one or two ticks.
     
  6. Offline

    Machine Maker

    @Zombie_Striker Thanks! So to go about doing this, and I think placing the heads at the bottom of the world will work best (like the last level of bedrock), should I just get the Players location in integers eg (X, Y, Z) and set Y to 0, then what?


    Nvm. I got it working!
     
    Last edited: Jun 29, 2017
Thread Status:
Not open for further replies.

Share This Page