Solved Inventory Skulls

Discussion in 'Spigot Plugin Development' started by MadMaxCookie, May 11, 2016.

  1. So I'm going to make a gui status of the player :D

    so I have an inventory made
    I just wanted to get the viewers of the gui then set them the owner of the skull itemstack
    but even their skull is not appearing

    I used InventoryOpenEvent
    Code (Java):
            Player p = (Player) e.getPlayer();
            ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
            SkullMeta sm = (SkullMeta)skull.getItemMeta();
            sm.setOwner(p.getName());
            sm.setDisplayName(plugin.colorize("&e&lStatus"));
            Glow glow = new Glow(70);
            sm.addEnchant(glow, 1, true);
            skull.setItemMeta(sm);
            inv.setItem(0, skull);
     
  2. MiniDigger

    Supporter

    did you update the inventory?
     
  3. its Bukkit.getServer().createInventory(null, 9, plugin.colorize("&6&lRelationShip"));
    inventory
     
  4. Why do you use p.getname(), why not p.toString(); ? I guess it doesn't really matter but idk, I will try to help you when I get home if you haven't achieved the goal yet
     
  5. fixed already by myself my bad I used this code as an alternative way
    Code (Java):
    e.getInventory().setItem(0,skull);
     
  6. Try this:
    Code (Text):
            ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
            SkullMeta metahead = (SkullMeta) head.getItemMeta();
            metahead.setOwner(p.getName());
            metahead.setDisplayName(plugin.colorize("&e&lStatus"));
            head.setItemMeta(metahead);
            Glow glow = new Glow(70);
            headmeta.addEnchant(glow, 1, true);
            inv.setItem(0, head);
     
  7. MiniDigger

    Supporter

    this is like exact the same code op has...
    also, you code doesn't work since you add the enchantment after reappling the meta.
     
  8. I don't change the line where I put the inv.setItem thingyy
    thats what I did I forgot to tell that I change it to (short)3 and always check the prefix before commenting :D
     
  9. Srry but when i reply the post it wasn´t solved
     
    • Friendly Friendly x 1
  10. no problem dood lets stop bumping this thread don't reply have a nice day :D