2023-07-06 03:24:06 +00:00
|
|
|
package com.alttd.playerutils.config;
|
|
|
|
|
|
|
|
|
|
import com.alttd.playerutils.util.Logger;
|
|
|
|
|
|
2023-07-07 21:49:34 +00:00
|
|
|
import java.io.File;
|
|
|
|
|
|
2023-07-06 03:24:06 +00:00
|
|
|
public class Config extends AbstractConfig{
|
|
|
|
|
|
|
|
|
|
static Config config;
|
|
|
|
|
private Logger logger;
|
|
|
|
|
|
2023-07-07 21:49:34 +00:00
|
|
|
Config(Logger logger) {
|
|
|
|
|
super(
|
|
|
|
|
new File(System.getProperty("user.home") + File.separator
|
|
|
|
|
+ "share" + File.separator
|
|
|
|
|
+ "configs" + File.separator
|
|
|
|
|
+ "PlayerUtils"),
|
|
|
|
|
"config.yml", logger);
|
2023-07-06 03:24:06 +00:00
|
|
|
this.logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-07 21:49:34 +00:00
|
|
|
public static void reload(Logger logger) {
|
2023-07-06 03:24:06 +00:00
|
|
|
logger.info("Reloading config");
|
2023-07-07 21:49:34 +00:00
|
|
|
config = new Config(logger);
|
2023-07-06 03:24:06 +00:00
|
|
|
config.readConfig(Config.class, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class SETTINGS {
|
|
|
|
|
private static final String prefix = "settings.";
|
|
|
|
|
public static boolean DEBUG = false;
|
|
|
|
|
public static boolean WARNINGS = true;
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
|
private static void load() {
|
|
|
|
|
DEBUG = config.getBoolean(prefix, "debug", DEBUG);
|
|
|
|
|
WARNINGS = config.getBoolean(prefix, "warnings", WARNINGS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|