java.lang.Object
com.winterhavenmc.library.messagebuilder.model.language.ValidItemRecord
All Implemented Interfaces:
ItemRecord, SectionRecord, Pluralizable

public final class ValidItemRecord extends Object implements ItemRecord, Pluralizable
A validated, immutable ItemRecord representing a localized or macro-enabled item definition loaded from the ITEMS section of a language YAML file.

A ValidItemRecord includes singular and plural display names, optional inventory-specific name overrides, and a list of lore lines. It also implements Pluralizable to provide dynamic name selection based on quantity.

This class is instantiated using the static create(RecordKey, ConfigurationSection) method, which applies YAML-based parsing and normalization of optional fields.

See Also:
  • Method Details

    • create

      public static ValidItemRecord create(RecordKey key, org.bukkit.configuration.ConfigurationSection section)
      Creates a ValidItemRecord from a configuration section.

      This method parses each field from the YAML structure and wraps the result into a validated record. All fields are assumed to be non-null if present, and fallback behavior is the caller's responsibility.

      Parameters:
      key - the unique identifier for this item
      section - the configuration section representing the item
      Returns:
      a new validated item record
    • nameFor

      public String nameFor(int quantity)
      Returns the appropriate name form (singular or plural) based on quantity.
      Specified by:
      nameFor in interface Pluralizable
      Parameters:
      quantity - the number of items
      Returns:
      nameSingular if quantity is 1; otherwise namePlural
    • key

      public RecordKey key()
      Specified by:
      key in interface SectionRecord
    • nameSingular

      public String nameSingular()
      Specified by:
      nameSingular in interface Pluralizable
    • namePlural

      public String namePlural()
      Specified by:
      namePlural in interface Pluralizable