Remove ItemFlag

Discussion in 'Spigot Plugin Development' started by Helti, Jun 10, 2015.

  1. Good evening,

    i am trying to remove the ItemFlag of an item, but it doesn't work.
    Code (Text):
    private ItemStack createItem(String name,Material mat){
                ItemStack is = new ItemStack(mat);
                ItemMeta isMeta = is.getItemMeta();
                isMeta.setDisplayName(name);
                isMeta.setLore(null);
                isMeta.removeItemFlags(HIDE_ATTRIBUTES);//Here i try to remove it
                System.out.println(is.getItemMeta());
                is.setItemMeta(isMeta);
                return is;
            }
    This is the methode, I am creating a new Item.
    My problem is, that the value "HIDE_ATTRIBUTES" is unknown in this context.

    Thanks for helping me.

    Helti
     
  2. Wouldn't you need to tell the method that you are passing an ItemFlag?
    Code (Text):
    isMeta.removeItemFlags(ItemFlag.HIDE_ATTRIBUTES);
     
  3. Thank you very much for this advise.
    But it didn't solve my real problem.
    There is a picture: Link
    this blue text, how can i remove it?
     
  4. I don't think that if possible with the api. You would need to work with NBT. Link
     
  5. You would want to add the flag. Removing a flag called "HIDE" would obviously make it visible.