public abstract class Config extends Object implements ConfigurationProvider
Constructor and Description |
---|
Config(File configFile)
Create a new Config instance, this will *not* load the config by default.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
get(String key,
Class<T> clazz,
T def) |
boolean |
getBoolean(String key,
boolean def) |
abstract URL |
getDefaultConfigURL() |
double |
getDouble(String key,
double def) |
int |
getInt(String key,
int def) |
List<Integer> |
getIntegerList(String key) |
@Nullable String |
getString(String key,
@Nullable String def) |
abstract List<String> |
getUnsupportedOptions() |
Map<String,Object> |
getValues()
Get all the configuration values
|
protected abstract void |
handleConfig(Map<String,Object> config) |
Map<String,Object> |
loadConfig(File location) |
void |
reloadConfig()
Reloads the config
|
void |
saveConfig()
Saves the config
|
void |
saveConfig(File location,
Map<String,Object> config) |
void |
set(String path,
Object value)
Sets the specified path to the given value.
|
public Config(File configFile)
reloadConfig()
configFile
- The location of where the config is loaded/saved.public abstract URL getDefaultConfigURL()
public void set(String path, Object value)
ConfigurationProvider
set
in interface ConfigurationProvider
path
- Path of the object to set.value
- New value to set the path topublic void saveConfig()
ConfigurationProvider
saveConfig
in interface ConfigurationProvider
public void reloadConfig()
ConfigurationProvider
reloadConfig
in interface ConfigurationProvider
public Map<String,Object> getValues()
ConfigurationProvider
getValues
in interface ConfigurationProvider
public boolean getBoolean(String key, boolean def)
public int getInt(String key, int def)
public double getDouble(String key, double def)
Copyright © 2016–2021. All rights reserved.