Files
AlathranWars/src/main/java/com/github/alathra/alathranwars/config/ConfigHandler.java
T
darksaid98 b1a95ed011 refactor: prepare for raids
- Recode most classes
- Add phases to battles
- Pull updates from gradle-template-plugin
2024-09-21 10:37:15 +02:00

59 lines
1.4 KiB
Java

package com.github.alathra.alathranwars.config;
import com.github.alathra.alathranwars.AlathranWars;
import com.github.alathra.alathranwars.Reloadable;
import com.github.milkdrinkers.crate.Config;
import javax.inject.Singleton;
/**
* A class that generates/loads {@literal &} provides access to a configuration file.
*/
@Singleton
public class ConfigHandler implements Reloadable {
private final AlathranWars plugin;
private Config cfg;
private Config databaseCfg;
/**
* Instantiates a new Config handler.
*
* @param plugin the plugin instance
*/
public ConfigHandler(AlathranWars plugin) {
this.plugin = plugin;
}
@Override
public void onLoad() {
cfg = new Config("config", plugin.getDataFolder().getPath(), plugin.getResource("config.yml")); // Create a config file from the template in our resources folder
databaseCfg = new Config("database", plugin.getDataFolder().getPath(), plugin.getResource("database.yml"));
}
@Override
public void onEnable() {
}
@Override
public void onDisable() {
}
/**
* Gets main config object.
*
* @return the config object
*/
public Config getConfig() {
return cfg;
}
/**
* Gets database config object.
*
* @return the config object
*/
public Config getDatabaseConfig() {
return databaseCfg;
}
}