Class ConfigurateConfig

java.lang.Object
io.github.projectunified.craftconfig.configurate.ConfigurateConfig
All Implemented Interfaces:
Config, ConfigNode

public class ConfigurateConfig extends Object implements Config
The Config implementation for Configurate
  • Constructor Details

    • ConfigurateConfig

      public ConfigurateConfig(File file, org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder<?,?> builder)
  • Method Details

    • get

      public Object get()
      Description copied from interface: ConfigNode
      Get the value at this node
      Specified by:
      get in interface ConfigNode
      Returns:
      the value, or null if not present
    • set

      public void set(Object value)
      Description copied from interface: ConfigNode
      Set the value at this node
      Specified by:
      set in interface ConfigNode
      Parameters:
      value - the value to set
    • node

      public ConfigNode node(String... path)
      Description copied from interface: ConfigNode
      Navigate to a child node. Should only be called if ConfigNode.hasChild() returns true.
      Specified by:
      node in interface ConfigNode
      Parameters:
      path - the path segments (relative to this node)
      Returns:
      the child node
    • remove

      public void remove()
      Description copied from interface: ConfigNode
      Remove this node from the configuration
      Specified by:
      remove in interface ConfigNode
    • getChildren

      public Map<String,ConfigNode> getChildren()
      Description copied from interface: ConfigNode
      Get the child nodes of this node. Should only be called if ConfigNode.hasChild() returns true.
      Specified by:
      getChildren in interface ConfigNode
      Returns:
      map of child key to child node
    • getComment

      public List<String> getComment(CommentType type)
      Description copied from interface: ConfigNode
      Get the comment for this node
      Specified by:
      getComment in interface ConfigNode
      Parameters:
      type - the comment type
      Returns:
      the comment lines, or empty list if none
    • setComment

      public void setComment(CommentType type, List<String> value)
      Description copied from interface: ConfigNode
      Set the comment for this node
      Specified by:
      setComment in interface ConfigNode
      Parameters:
      type - the comment type
      value - the comment lines, or null to remove
    • getName

      public String getName()
      Description copied from interface: Config
      Get the name of the configuration (typically the file name)
      Specified by:
      getName in interface Config
      Returns:
      the name
    • setup

      public void setup()
      Description copied from interface: Config
      Set up the configuration (create file, load initial data)
      Specified by:
      setup in interface Config
    • save

      public void save()
      Description copied from interface: Config
      Save the configuration to disk
      Specified by:
      save in interface Config
    • reload

      public void reload()
      Description copied from interface: Config
      Reload the configuration from disk
      Specified by:
      reload in interface Config
    • getOriginal

      public Object getOriginal()
      Description copied from interface: Config
      Get the original underlying object (e.g., JsonObject, ConfigurationNode)
      Specified by:
      getOriginal in interface Config
      Returns:
      the original instance
    • normalize

      public Object normalize(Object object)
      Description copied from interface: Config
      Normalize a library-specific object to plain Java types
      Specified by:
      normalize in interface Config
      Parameters:
      object - the object to normalize
      Returns:
      the normalized object
    • isNormalizable

      public boolean isNormalizable(Object object)
      Description copied from interface: Config
      Check if the object can be normalized
      Specified by:
      isNormalizable in interface Config
      Parameters:
      object - the object
      Returns:
      true if it is normalizable