Package top.focess.qq.api.util.config
Class DefaultConfig
- java.lang.Object
-
- top.focess.qq.api.util.config.Config
-
- top.focess.qq.api.util.config.DefaultConfig
-
public class DefaultConfig extends Config
Represents a default config named "config.yml" in the plugin folder.
-
-
Constructor Summary
Constructors Constructor Description DefaultConfig(File file)DefaultConfig(top.focess.util.yaml.YamlConfiguration yamlConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(String key)Indicate there is a configuration named key<T> Tget(String key)Get the value of the specified key<T> TgetOrDefault(String key, T def)DefaultConfiggetSection(String key)Get the section named key Note: if the section named key does not exist, it will be createdMap<String,Object>getValues()Get all the configuration as a mapvoidremove(String key)Remove the configuration named keyvoidsave()Save the configuration to the filevoidset(String key, @Nullable Object value)Set the value of the specified key
-
-
-
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:ConfigSet the value of the specified key
-
get
@Nullable public <T> T get(String key)
Description copied from class:ConfigGet the value of the specified key
-
save
public void save()
Description copied from class:ConfigSave the configuration to the file
-
getValues
public Map<String,Object> getValues()
Description copied from class:ConfigGet all the configuration as a map
-
contains
public boolean contains(String key)
Description copied from class:ConfigIndicate there is a configuration named key
-
getOrDefault
public <T> T getOrDefault(String key, T def)
-
remove
public void remove(String key)
Description copied from class:ConfigRemove the configuration named key
-
getSection
public DefaultConfig getSection(String key)
Description copied from class:ConfigGet the section named key Note: if the section named key does not exist, it will be created- Specified by:
getSectionin classConfig- Parameters:
key- the key of the Section- Returns:
- the section named key
-
-