Solved Adding/getting data from on items

Discussion in 'Plugin Development' started by Jozeth, Oct 16, 2013.

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

    Jozeth

    How do I create an item with a certain metadata, so if it's picked up it says a message?

    So if the plugin spawns a bone with some data and if a player picks it up (checks for the data) and then says a message.
     
  2. Offline

    TrollTaylor

    Try this
    Code:
    ItemStack chest = new ItemStack(299, 1, (short) 3);
    LeatherArmorMeta chestmeta = (LeatherArmorMeta) chest.getItemMeta();
     
    @EventHandler
        public void onPickup(PlayerItemConsumeEvent event){
            if(event.getItem().equals(chest)){
                event.getPlayer().sendMessage("Picked Up Item");
            }
        }
     
     
     
    
    Change 299 to the item id you want to use i used leather chestplate
    Hope this helps!
     
  3. Offline

    Jozeth

    I want to know how to set ItemMeta and be able to retrieve it.

    Doesn't matter now - I have found an alternative way of doing it.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
Thread Status:
Not open for further replies.

Share This Page