.

Discussion in 'Plugin Development' started by elementalgodz11, Nov 29, 2013.

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

    elementalgodz11

  2. Offline

    AoH_Ruthless

    elementalgodz11
    Set the lore to null?

    elementalgodz11
    Code:java
    1. pvp.setLore(null);


    elementalgodz11
    The only other thing I can think of at the moment is pvp.setLore("");

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

    Pocketkid2

    Isn't a lore just a list of strings? I think getLore() returns List<String>. But Aoh_Ruthless is right about setLore(null) removing lores, I have done it myself.

    Hmm, that's odd, the javadocs and my personal experience say that it takes List<String> and returns it. What version of bukkit are you using?

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

    AoH_Ruthless

  5. Offline

    Pocketkid2

    Did you try setting the new itemmeta back into the itemstack?
    Code:java
    1. ItemStack stack = player.getItemInHand();
    2. ItemMeta meta = stack.getItemMeta();
    3. meta.setLore(null);
    4. stack.setItemMeta(meta);
    5. player.setItemInHand(stack);


    Obviously, you can just ignore the setItemInHand and getItemInHand
     
  6. Offline

    AoH_Ruthless

    elementalgodz11
    I have no idea then, sorry.

    Pocketkid2
    If you look closely, he did.

    The Gaming Grunts
    I don't think so because Arrays.asList is an object list whereas setLore is a String List

    EDIT: yep "The method setLore(List<String>) in the type ItemMeta is not applicable for the arguments (List<Object>)" taken from Eclipse.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  7. AoH_Ruthless
    Idk. I only say that because you use that method to set the lore in the first place, so why not use that to set the lore to null?

    AoH_Ruthless elementalgodz11
    Try doing this :

    Code:java
    1. String stuff = null;
    2.  
    3. //your code
    4. YourItemMeta.setLore(Arrays.asList(stuff));


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

    AoH_Ruthless

  9. AoH_Ruthless
    Maybe :p The above code doesn't give any errors in Eclipse, but idk if it will actually work in-game. It's up to elementalgodz11 to find out :p

    elementalgodz11
    Try what AoH_Ruthless suggested with an ArrayList<String>

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

    AoH_Ruthless

    elementalgodz11
    That's what you've been trying to do??? You should know that that + attack damage thing is a client side lore and isn't removed with that method.
     
    The Gaming Grunts likes this.
  11. elementalgodz11
    First of all, thanks for tagging me 2x :p To go with what AoH_Ruthless said, that "+7 Attack Damage" thing itsn't an item lore. It only gets displayed if the player is in creative mode. As far as I know, there is no way to remove that.

    elementalgodz11
    Exactly, it's client-side. There is no way to do this with the server. Problem solved :p

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

    AoH_Ruthless

  13. Offline

    TryB4

  14. Offline

    kreashenz

    That isn't a lore, it's an attribute. And by removing it, the sword will do the damage of a stick. There's no other way, yet, that you can remove it unless you use that link that TryB4 posted above. That MIGHT not work, seeing as it's 1.6.2, but I'll work on updating that.
     
Thread Status:
Not open for further replies.

Share This Page