Setting item lore

Discussion in 'Plugin Development' started by NeonFXFusion, Jan 19, 2013.

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

    NeonFXFusion

    I got a item rename plugin but i want it to be able to set/replace the lore too. I looked up at a few threads and i have no idea how to set/replace it. I know i need at least 2 classes for that. Any help is appriceated.
     
  2. Offline

    fireblast709

    Code:java
    1. ItemStack stack = new ItemStack(Material.STONE, 1);
    2. ItemMeta meta = stack.getItemMeta();
    3. ArrayList<String> lore = new ArrayList<String>();
    4. lore.add("O holy stone");
    5. lore.add("Ye who protects me from evil");
    6. meta.setLore(lore);
    7. stack.setItemMeta(meta)
     
    FirecatHD and RainoBoy97 like this.
  3. Offline

    _Ass4ssin_

    If I am right it would be like this:

    Code:
    ItemStack FireWand = new ItemStack(Material.BLAZE_ROD, 1);
    ItemMeta im = FireWand.getItemMeta();
    im.setDisplayName(ChatColor.RED + "FireWand");
    im.setlore("A magic firewand")
    FireWand.setItemMeta(im);
    correct me when I am wrong!

    Ugh fireblast was like 1 second ahead of me!
    But, his code is slightly better I see, so I suggest his!
     
  4. Offline

    NeonFXFusion

    fireblast709 You are the most helpful person! Does this forums have rep? I want to rep+ you
     
  5. Offline

    fireblast709

    NeonFXFusion there is 'liking' a post and following someone
     
  6. Offline

    NeonFXFusion

    fireblast709 and hot to make it so it gets the players item in hand and sets the lore?
     
  7. Offline

    t7seven7t

    NeonFXFusion You can get the item in a player's hand using
    player.getItemInHand()
     
  8. Offline

    fireblast709

    Code:java
    1. ItemStack hand = player.getItemInHand();
    2. ItemMeta meta = hand.getItemMeta();
    3. ArrayList<String> lore = new ArrayList<String>();
    4. lore.add("This is lore");
    5. lore.add("And it looks pwetty :3");
    6. meta.setLore(lore);
    7. hand.setItemMeta(meta);
     
    Xp10d3 likes this.
Thread Status:
Not open for further replies.

Share This Page