Solved Renaming Items

Discussion in 'Plugin Development' started by snake4212, Feb 17, 2013.

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

    snake4212

    How do I rename items through code?
    Because I have Items creating through and ItemStack its called goldhoe however I can not add someting like goldhoe.setName("Poop");
    Eclipse will not recongnize setName is this the wrong code help me rename items!
     
  2. Offline

    RainoBoy97

    Code:
    ItemStack itemstack = new ItemStack(Material.DIAMOND, 1);
    ItemMeta im = itemstack.getItemMeta();
    im.setName("DIAMONDZZZZZZZZZZ");
    itemstack.setItemMeta(im);
    
     
  3. Offline

    snake4212

    Sorry I got completely lost there do you have skype so you can help me out
     
  4. Offline

    RainoBoy97

    Code:
    //Here you create a new itemstack, you can also get a itemstack from an event/command etc
    ItemStack itemstack = new ItemStack(Material.DIAMOND, 1);
     
    //Here you get the ItemMeta for the item, ItemMeta is the lore, displayname etc
    ItemMeta im = itemstack.getItemMeta();
     
    //here we set the name for the item
    im.setDisplayName("diamondzzzz");
     
    //now we need to set the ItemMeta so the item gets the new name
    itemstack.setItemMeta(im);
    
     
Thread Status:
Not open for further replies.

Share This Page