Rename items

Discussion in 'Plugin Development' started by Forseth11, Oct 28, 2013.

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


    How would I create a method to rename ItemStacks like you see on large servers in the inventories.
    I tried setting display name and that does not work.
  2. Offline


    you want to get the itemstack at hand first, get that metadata, set the display name and lore through the metadata, then set the itemstack's metadata to the new metadata:

    1. ItemStack i = new ItemStack(Material.STONE);
    2. ItemMeta meta = i.getItemMeta();
    3. ArrayList<String> lore = new ArrayList<String>();
    4. lore.add("This is lore");
    5. meta.setLore(lore);
    6. meta.setDisplayName("Not Stone");
    7. i.setItemMeta(meta)
  3. Offline


    Make sure when you're done you execute setItemMeta(meta) on the ItemStack object.
    Shzylo likes this.
  4. Offline


Thread Status:
Not open for further replies.

Share This Page