Class ItemFlagModifier
java.lang.Object
io.github.projectunified.craftitem.spigot.modifier.ItemFlagModifier
- All Implemented Interfaces:
ItemModifier,SpigotItemModifier
Spigot modifier that adds item flags to hide or show specific item attributes.
Flags control what information is displayed in the item tooltip. Special value "all" applies all available flags.
Example Usage:
// Hide enchantments and attributes
ItemModifier mod1 = new ItemFlagModifier(List.of(
"HIDE_ENCHANTS",
"HIDE_ATTRIBUTES"
));
// Hide everything
ItemModifier mod2 = new ItemFlagModifier(List.of("all"));
// From ItemFlag enum
ItemModifier mod3 = new ItemFlagModifier(
List.of(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES)
);
-
Constructor Summary
ConstructorsConstructorDescriptionItemFlagModifier(Collection<org.bukkit.inventory.ItemFlag> flags) Creates a new ItemFlagModifier from ItemFlag enum values.ItemFlagModifier(List<String> flags) Creates a new ItemFlagModifier with the specified flag names. -
Method Summary
Modifier and TypeMethodDescriptionvoidmodify(SpigotItem item, UnaryOperator<String> translator) Applies the parsed item flags to the item.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.projectunified.craftitem.spigot.core.SpigotItemModifier
modify
-
Constructor Details
-
ItemFlagModifier
Creates a new ItemFlagModifier with the specified flag names. Flag names are case-insensitive and spaces are converted to underscores.- Parameters:
flags- the list of item flag names (or "all")
-
ItemFlagModifier
Creates a new ItemFlagModifier from ItemFlag enum values.- Parameters:
flags- the collection of ItemFlag enums
-
-
Method Details
-
modify
Applies the parsed item flags to the item.- Specified by:
modifyin interfaceSpigotItemModifier- Parameters:
item- the SpigotItem to modifytranslator- the string translator for variable substitution
-