Solved Removing potion descriptions

Discussion in 'Plugin Development' started by Rixterz, Nov 18, 2015.

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

    Rixterz

    Hi,

    Quite a simple one: how can I remove the circled text?

    [​IMG]

    I've managed to do it for things like swords with the following code but it won't work with potions:
    Code:
    public ItemStack removeNBT(ItemStack i){
            ItemStack item = i.clone();
            net.minecraft.server.v1_8_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
            NBTTagCompound tag;
            if (!nmsStack.hasTag()){
                tag = new NBTTagCompound();
                nmsStack.setTag(tag);
            }else{
                tag = nmsStack.getTag();
            }
            NBTTagList am = new NBTTagList();
            tag.set("AttributeModifiers", am);
            nmsStack.setTag(tag);
            return CraftItemStack.asBukkitCopy(nmsStack);
        }
    -Rix
     
  2. @Rixterz
    Get the item's ItemMeta, then call ItemMeta#addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); to hide the potion effects
     
    Rixterz likes this.
  3. Offline

    Rixterz

    Thank you! :3
     
Thread Status:
Not open for further replies.

Share This Page