Solved Annotations under item name.

Discussion in 'Plugin Development' started by Louisfx, Jul 29, 2014.

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

    Louisfx

    Hello so I'm trying to make so that when a player set the cursor on an item, under the item name it's telling like "click to join".
    Example on Hypixel: [​IMG]
     
  2. Offline

    Giraffeknee

    ItemStack item = player.getItemInHand();
    ItemMeta im = item.getItemMeta();
    List<String> lore = im.getLore();
    lore.add("anything");
    im.setLore(lore);
    item.setItemMeta(im);

    That is definitely not the short way to do it :) but it should work.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  3. Offline

    mythbusterma

    That's pretty much the only way.
     
  4. Offline

    Giraffeknee

  5. Offline

    FabeGabeMC

    Louisfx
    You can get the item's meta and set its lore to whatever you want.
    Example:
    Code:java
    1. ItemMeta m = yourItem.getItemMeta();
    2. m.setLore(Arrays.asList("This is line one.",
    3. "This is line two."));
    4. yourItem.setItemMeta(m);
     
    Louisfx likes this.
  6. Offline

    mythbusterma

    FabeGabeMC

    Nevermind didn't look at it closely enough, you're right
     
    FabeGabeMC likes this.
  7. Offline

    Louisfx

    FabeGabeMC likes this.
  8. Offline

    Giraffeknee

    You do realize that I gave you the first correct answer, right? No problem though...
     
  9. Offline

    Louisfx

    Giraffeknee You did a long code that wasn't working and FabeGabeMC did a shorter one that was working but thank you for trying to help me :)
     
    FabeGabeMC likes this.
  10. Offline

    Giraffeknee

    ...mine is actually correct...
     
  11. Offline

    Dragonphase

    Giraffeknee
    It's incorrect. Your item was an Item, not an ItemStack.

    Louisfx

    Create a method which does all of this so you don't have repeating code.
     
  12. Offline

    ZodiacTheories

  13. Offline

    FabeGabeMC

  14. Offline

    Giraffeknee

    Dragonphase
    The edit :p. I'll admit it was incorrect.
     
Thread Status:
Not open for further replies.

Share This Page