Changing item names

Discussion in 'Plugin Development' started by tamar, Oct 27, 2013.

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

    tamar

    How do you change the name of an item. For example change Iron Sword to Cantaloupe?
     
  2. Offline

    achap1989

    tamar
    Code:java
    1. item.setDisplayName(name);


    Here is an example
    Code:java
    1. private ItemStack createItem(DyeColor dc, String name) {
    2. ItemStack i = new Wool(dc).toItemStack(1);
    3. ItemMeta im = i.getItemMeta();
    4. im.setDisplayName(name);
    5. im.setLore(Arrays.asList("Set your gamemode", "to " + name.toLowerCase() + " mode"));
    6. i.setItemMeta(im);
    7. return i;
    8. }

    Please note, I did not write the code, it came from a tutorial.
     
  3. Offline

    tamar

    thank you :)
     
Thread Status:
Not open for further replies.

Share This Page