mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-01 14:38:55 +00:00
- Recode most classes - Add phases to battles - Pull updates from gradle-template-plugin
59 lines
1.4 KiB
Java
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;
|
|
}
|
|
}
|