Class ConfigSection<T extends IConfigSectionResult>
java.lang.Object
nl.pim16aap2.animatedarchitecture.core.config.ConfigSection<T>
- Direct Known Subclasses:
AnimationsSection, CachingSection, GeneralSection, LimitsSection, LocaleSection, LoggingSection, ProtectionHooksSection, RedstoneSection, StructuresSection
Represents a section in the configuration.
This interface defines the contract for configuration sections, which are used to define specific parts of the configuration with their own initial transform actions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidapplyResults(org.spongepowered.configurate.ConfigurationNode root, boolean silent) Applies the results of this section.abstract org.spongepowered.configurate.CommentedConfigurationNodeBuilds the initial limits node for this configuration section.protected StringformatDefaultCollection(Collection<String> values) Formats a default collection of values as a string.protected abstract TgetResult(org.spongepowered.configurate.ConfigurationNode sectionNode, boolean silent) Gets the result of this configuration section.Gets the consumer that will handle the result of this configuration section.org.spongepowered.configurate.CommentedConfigurationNodegetSection(org.spongepowered.configurate.CommentedConfigurationNode root) Gets the subsection for this configuration section.abstract StringReturns the title of the configuration section.voidpopulateDynamicData(org.spongepowered.configurate.CommentedConfigurationNode root) Populates the dynamic data for this configuration section.
-
Constructor Details
-
ConfigSection
public ConfigSection()
-
-
Method Details
-
buildInitialLimitsNode
public abstract org.spongepowered.configurate.CommentedConfigurationNode buildInitialLimitsNode() throws org.spongepowered.configurate.serialize.SerializationExceptionBuilds the initial limits node for this configuration section.This method is responsible for creating the initial configuration node for this section, including any default values and comments.
- Returns:
- the initial limits node for this section
- Throws:
org.spongepowered.configurate.serialize.SerializationException- if an error occurs during serialization
-
getResult
protected abstract T getResult(org.spongepowered.configurate.ConfigurationNode sectionNode, boolean silent) throws org.spongepowered.configurate.serialize.SerializationException Gets the result of this configuration section.- Parameters:
sectionNode- The configuration node for this section.silent- When true, the method will not log any informational/status messages when parsing the results.- Returns:
- the result of this configuration section
- Throws:
org.spongepowered.configurate.serialize.SerializationException- If an error occurs during serialization.
-
getResultConsumer
-
formatDefaultCollection
Formats a default collection of values as a string.- Parameters:
values- The values to format as a collection.- Returns:
- A string representation of the collection, or "[]" if no values are provided.
-
applyResults
public final void applyResults(org.spongepowered.configurate.ConfigurationNode root, boolean silent) throws org.spongepowered.configurate.serialize.SerializationException Applies the results of this section.- Parameters:
root- The root configuration node to read the data from.silent- When true, the method will not log any informational/status messages when parsing the results.- Throws:
org.spongepowered.configurate.serialize.SerializationException
-
getSection
public org.spongepowered.configurate.CommentedConfigurationNode getSection(org.spongepowered.configurate.CommentedConfigurationNode root) Gets the subsection for this configuration section.- Parameters:
root- The root configuration node to get the subsection from.- Returns:
- the subsection node for this configuration section
- Throws:
IllegalStateException- if the section does not exist.
-
populateDynamicData
public void populateDynamicData(org.spongepowered.configurate.CommentedConfigurationNode root) Populates the dynamic data for this configuration section.This method will not overwrite existing data in the node; it will only add new data if any is missing.
- Parameters:
root- The root configuration node to populate with dynamic data.
-
getSectionTitle
Returns the title of the configuration section.- Returns:
- the title of the section
-