Yaml Config

Base config creator

public BaseConfig(JavaPlugin plugin, String path, boolean hasInResource, Configuration defaultConfig)
public BaseConfig(JavaPlugin plugin, String path, boolean hasInResource)
public BaseConfig(JavaPlugin plugin, String path)
public BaseConfig(JavaPlugin plugin, String path, Configuration defaultConfig)

Options:

  • plugin - your plugin instance

  • path - config path (For example "lang.yml")

  • hasInResource - if true, then when creating, if there is no file, it is copied from the resources of your plugin (resource with the same path)

  • defaultConfig - default config data

Load/reload

public void load()

Save

public void save()

Get object of ?

public Object get(String key)
public String getString(String key) //immediately colors the text
public Integer getInt(String key)
public Boolean getBoolean(String key)
public Map<String, Object> getMap(String key, Boolean b)

Get list of ?

public List getList(String path)
public List<String> getStringList(String key) //immediately colors the text
public List<Integer> getIntList(String key)
public List<Boolean> getBooleanList(String key)

Contain

public boolean contains(String key)

Defaults

public void addDefault(String path, Object value)
public void copyDefault(boolean b)

After adding a new default value, be sure to save the config

Set

public void set(String key, Object value)

After setting a new value, be sure to save the config

Last updated