Class ValidItemRecord
java.lang.Object
com.winterhavenmc.library.messagebuilder.model.language.ValidItemRecord
- All Implemented Interfaces:
ItemRecord
,SectionRecord
,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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.winterhavenmc.library.messagebuilder.model.language.ItemRecord
ItemRecord.Field
-
Method Summary
Modifier and TypeMethodDescriptionstatic ValidItemRecord
Creates aValidItemRecord
from a configuration section.key()
nameFor
(int quantity) Returns the appropriate name form (singular or plural) based on quantity.
-
Method Details
-
create
public static ValidItemRecord create(RecordKey key, org.bukkit.configuration.ConfigurationSection section) Creates aValidItemRecord
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 itemsection
- the configuration section representing the item- Returns:
- a new validated item record
-
nameFor
Returns the appropriate name form (singular or plural) based on quantity.- Specified by:
nameFor
in interfacePluralizable
- Parameters:
quantity
- the number of items- Returns:
nameSingular
if quantity is 1; otherwisenamePlural
-
key
- Specified by:
key
in interfaceSectionRecord
-
nameSingular
- Specified by:
nameSingular
in interfacePluralizable
-
namePlural
- Specified by:
namePlural
in interfacePluralizable
-