Custom Item MetaData

Discussion in 'Plugin Development' started by gyus, Aug 11, 2014.

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

    gyus

    Hi all!

    There is a way to add some kind of metadata to an itemstack? Im not talking about ItemMeta,
    i need to add some metadata not persistent between reloads and invisible to players.
     
  2. Offline

    thijs_a

    What do you mean with metadata?
     
  3. Offline

    Skionz

    gyus I think your best option would be just to change the display name or lore to like a different color or something similar like this

    Code:
    ItemStack diamonds = new ItemStack(Material.DIAMOND, 64);
    ItemMeta diaMeta = diamonds.getItemMeta();
    diaMeta.setDisplayName(ChatColor.GOLD + "Diamonds");
    diamonds.setItemMeta(diaMeta);
    then to check for it just do
    Code:
    if(item.hasItemMeta() && item.getItemMeta.getDisplayName() == ChatColor.GOLD + "Diamonds") {
      //item has the name
    }
    else {
      //item does not have the name
    }
     
  4. Offline

    gyus

    Skionz I know what you say but i don't know how may it help me :p I have both display name and lore modify on my plugin, but i need to add metadata, since i need to hide some info and erase it on shut down.
     
Thread Status:
Not open for further replies.

Share This Page