A simple API for Bukkit-like plugins to better use yaml configs
Add these lines to the <repositories>
section in your pom.xml
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
Then add these lines in your <dependencies>
section
<dependency>
<groupId>com.github.RickySHD</groupId>
<artifactId>SimpleConfigAPI</artifactId>
<version>1.0.1</version>
</dependency>
Add these lines to your pom.xml
and follow this guide to get a PAT.
<dependency>
<groupId>dev.rickyshd</groupId>
<artifactId>simpleconfigapi</artifactId>
<version>1.0.1</version>
</dependency>
public final class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
// initialize a new Config object
Config myConfig = Config.of(this, "config.yml");
// save the default configuration included in the jar [OPTIONAL]
myConfig.saveDefault();
// reload the config anytime you want
myConfig.reload();
// save the config to disk
myConfig.save();
// access its settings using the methods provided by the default Bukkit Configuration class
myConfig.set("my_setting", "hello_world");
myConfig.get("my_setting");
}
}