Skull meta

Discussion in 'Plugin Development' started by Random_Tomato, Oct 9, 2017.

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

    Random_Tomato

    Hey I need a little bit of help, there is an error with meta.setOwner("Rand0m_Tomato"); but I cannot figure out what it is, it is saying to add depreciation or something but I am unsure of what to do

    ItemStack random = new ItemStack(Material.SKULL_ITEM,1 , (byte)3);

    SkullMeta meta = (SkullMeta) Bukkit.getItemFactory().getItemMeta(Material.SKULL_ITEM);

    meta.setOwner("Rand0m_Tomato");

    meta.setDisplayName(ChatColor.RED + "RandomTomato");

    random.setItemMeta(meta);

    inv.setItem(51, random);

    Thanks
    Random
     
  2. Offline

    Zombie_Striker

    @Random_Tomato
    The reason that method is deprecated is because bukkit/spigot now wants you to use an OfflinePlayer instead of a string. This is useful for skulls of players that have already joined the server, because offlineplayer stores most of the data the skull needs. Just use Bukkit.getOfflinePlayer(.....) instead of the string.
     
    Last edited: Oct 10, 2017
  3. Offline

    Random_Tomato

  4. Offline

    Zombie_Striker

    @Random_Tomato
    Just add the text in bold (above) in the setOwner method, and replace the ... with the player's name.

    From a PM. Close; you just need to add quotes around the name.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 10, 2017
  5. Offline

    Random_Tomato

  6. Offline

    Zombie_Striker

Thread Status:
Not open for further replies.

Share This Page