java.lang.Object
io.github.projectunified.craftitem.spigot.modifier.LoreModifier
All Implemented Interfaces:
ItemModifier, SpigotItemModifier

public class LoreModifier extends Object implements 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 Details

    • LoreModifier

      public LoreModifier(List<String> lore)
      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

      public void modify(SpigotItem item, UnaryOperator<String> translator)
      Applies the translated lore to the item.
      Specified by:
      modify in interface SpigotItemModifier
      Parameters:
      item - the SpigotItem to modify
      translator - the string translator for variable substitution