refactor: prepare for raids

- Recode most classes
- Add phases to battles
- Pull updates from gradle-template-plugin
This commit is contained in:
darksaid98 committed 2024-09-21 10:37:15 +02:00
1 parent a4440c9283
commit b1a95ed011
105 files changed
+6941 -3296

No files matched your search

@@ -2,30 +2,32 @@ 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 com.github.milkdrinkers.crate.Config;
import javax.inject.Singleton;
/**
* A class that generates/loads & provides access to a configuration file.
* A class that generates/loads {@literal &} provides access to a configuration file.
*/
@Singleton
public class ConfigHandler implements Reloadable {
private final AlathranWars alathranWars;
private final AlathranWars plugin;
private Config cfg;
private Config databaseCfg;
/**
* Instantiates a new Config handler.
*
* @param alathranWars the plugin instance
* @param plugin the plugin instance
*/
public ConfigHandler(AlathranWars alathranWars) {
this.alathranWars = alathranWars;
public ConfigHandler(AlathranWars plugin) {
this.plugin = plugin;
}
@Override
public void onLoad() {
cfg = new Config("config", alathranWars.getDataFolder().getPath(), alathranWars.getResource("config.yml")); // Create a config file from the template in our resources folder
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
@@ -37,11 +39,20 @@ public class ConfigHandler implements Reloadable {
}
/**
* Gets alathranWars config object.
* Gets main config object.
*
* @return the alathranWars config object
* @return the config object
*/
public Config getConfig() {
return cfg;
}
/**
* Gets database config object.
*
* @return the config object
*/
public Config getDatabaseConfig() {
return databaseCfg;
}
}