Remove Item Description

Discussion in 'Plugin Development' started by bluegru, Mar 5, 2014.

Thread Status:
Not open for further replies.
  1. Is there a way to remove the item description '+7 Attack Damage' on tools and swords?
     
  2. Offline

    Pimp_like_me

    There is a plugin on BukkitDev called AttributesHider which will do the trick, I know there is some NBT way to do it but I don't know how to do that either my friend

    Whoops bluegru lol forgot to tag you

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

    Barinade

    string.replace("replaceme!", "withthis!");
    ("+7 Attack Damage", "")
     
  4. Offline

    Pimp_like_me

    Barinade, That wouldn't work because +7 Attack Damage is NBT Meta, not Item lore. So you couldn't even get that string in the first place
     
  5. Offline

    Barinade

    Not my code
    Code:
    
    https://forums.bukkit.org/threads/nbt-tags.110447/#post-1411523
                NBTTagCompound tag = getTag(p.getItemInHand());
                if(tag.getCompound("display") != null)
                {
                    tag.setCompound("display", new NBTTagCompound());
                }
                // Gets the display tag.
                NBTTagCompound display = tag.getCompound("display");
                //Removes the old name
                display.remove("Lore");
                //sets the new name
                NBTTagList list = new NBTTagList();
                list.add(new NBTTagString("TESTING"));
                display.set("Lore", list);
     
  6. Offline

    Pimp_like_me

    You didn't really explain that above :/
     
  7. Offline

    strubelcopter

  8. Offline

    Barinade

    ... What else needs to be explained?
     
  9. Offline

    Pimp_like_me

    Jeez, You forgot to tell him HOW to get the string from the nbt tags and how to remove it, wasn't really that explanatory
     
  10. Offline

    Barinade

    What part of
    Code:
             
                // Gets the display tag.
                //Removes the old name
                //sets the new name
    Are you failing to understand?
     
  11. Offline

    Pimp_like_me

    Omfg, Lord help you, I am not talking about myself, but instead before you posted the NBT code, how would HE have known how to get that string?
     
  12. Barinade I think he meant this:
     
  13. Offline

    Barinade

    display.get("Lore") might work, it returns NBTBase, NBTBase.a might be the array of lore, not sure.
    If you can't figure it out with some testing then I'll pitch in a few tests on my end. Until then, I can't give you a definitive answer.
     
Thread Status:
Not open for further replies.

Share This Page