Setting Lore of Item Already In Inventory

Discussion in 'Plugin Development' started by iWareWolf, May 23, 2014.

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

    iWareWolf

    I'm using this, but it is not working.

    Code:
                            List<String> lore = event.getItemDrop().getItemStack().getItemMeta().getLore();
                            lore.add(ChatColor.RESET + "RELOADING");
                            event.getItemDrop().getItemStack().getItemMeta().setLore(lore);
    I'm running a debug message and it should pass this code.

    This is pieces from my PlayerDropItemEvent. Could it be the reason that I am cancelling the event?
     
  2. Offline

    NathanWolf

    You have to call setItemMeta after you change the ItemMeta data. You might want to break it up into more than one line :)
     
  3. Offline

    mine-care

    That^
    Use a itemstack value of the dropped itemstack and get the meta and then set the lore, when done use itemstack.setitemmeta(item meta)
     
  4. Offline

    iWareWolf

    NathanWolf likes this.
Thread Status:
Not open for further replies.

Share This Page