Class DefaultConfig


  • public class DefaultConfig
    extends Config
    Represents a default config named "config.yml" in the plugin folder.
    • Constructor Detail

      • DefaultConfig

        public DefaultConfig​(File file)
                      throws top.focess.util.yaml.YamlLoadException
        Throws:
        top.focess.util.yaml.YamlLoadException
      • DefaultConfig

        public DefaultConfig​(top.focess.util.yaml.YamlConfiguration yamlConfiguration)
    • Method Detail

      • set

        public void set​(String key,
                        @Nullable
                        @Nullable Object value)
        Description copied from class: Config
        Set the value of the specified key
        Overrides:
        set in class Config
        Parameters:
        key - the key
        value - the value
      • get

        @Nullable
        public <T> T get​(String key)
        Description copied from class: Config
        Get the value of the specified key
        Overrides:
        get in class Config
        Type Parameters:
        T - the value type
        Parameters:
        key - the key
        Returns:
        the value
      • save

        public void save()
        Description copied from class: Config
        Save the configuration to the file
        Overrides:
        save in class Config
      • getValues

        public Map<String,​Object> getValues()
        Description copied from class: Config
        Get all the configuration as a map
        Overrides:
        getValues in class Config
        Returns:
        all the configuration as a map
      • contains

        public boolean contains​(String key)
        Description copied from class: Config
        Indicate there is a configuration named key
        Overrides:
        contains in class Config
        Parameters:
        key - the key
        Returns:
        true there is a configuration named key, false otherwise
      • getOrDefault

        public <T> T getOrDefault​(String key,
                                  T def)
      • remove

        public void remove​(String key)
        Description copied from class: Config
        Remove the configuration named key
        Overrides:
        remove in class Config
        Parameters:
        key - the key
      • getSection

        public DefaultConfig getSection​(String key)
        Description copied from class: Config
        Get the section named key Note: if the section named key does not exist, it will be created
        Specified by:
        getSection in class Config
        Parameters:
        key - the key of the Section
        Returns:
        the section named key