Class LoreModifier
java.lang.Object
io.github.projectunified.craftitem.spigot.modifier.LoreModifier
- All Implemented Interfaces:
ItemModifier,SpigotItemModifier
Spigot modifier that sets item lore (description lines).
Each line in the lore list is translated before being applied, allowing for dynamic lore generation with variable substitution.
Example Usage:
ItemModifier modifier = new LoreModifier(List.of(
"Made by ${creator}",
"Durability: ${durability}",
"Level: ${level}"
));
modifier.modify(item, s -> s
.replace("${creator}", "PlayerName")
.replace("${durability}", "1000")
.replace("${level}", "10")
);
-
Constructor Summary
ConstructorsConstructorDescriptionLoreModifier(List<String> lore) Creates a new LoreModifier with the specified lore lines. -
Method Summary
Modifier and TypeMethodDescriptionvoidmodify(SpigotItem item, UnaryOperator<String> translator) Applies the translated lore 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
-
LoreModifier
Creates a new LoreModifier with the specified lore lines. Lines can contain variables for translation.- Parameters:
lore- the list of lore lines
-
-
Method Details
-
modify
Applies the translated lore to the item.- Specified by:
modifyin interfaceSpigotItemModifier- Parameters:
item- the SpigotItem to modifytranslator- the string translator for variable substitution
-