src/main/java/com/alttd/playerutils/config/Config.java gelöscht
This commit is contained in:
parent
2777508caa
commit
d52ed69526
|
|
@ -1,95 +0,0 @@
|
|||
package com.alttd.playerutils.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
@Slf4j public class Config extends AbstractConfig{
|
||||
|
||||
static Config config;
|
||||
|
||||
Config() {
|
||||
super(
|
||||
new File(File.separator
|
||||
+ "mnt" + File.separator
|
||||
+ "configs" + File.separator
|
||||
+ "PlayerUtils"),
|
||||
"config.yml");
|
||||
}
|
||||
|
||||
public static void reload() {
|
||||
log.info("Reloading config");
|
||||
config = new Config();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public static class KEY {
|
||||
private static final String prefix = "key.";
|
||||
public static HashMap<String, Integer> CRATES = new HashMap<>();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static void load() {
|
||||
CRATES.clear();
|
||||
ConfigurationSection configurationSection = config.getConfigurationSection(prefix.substring(0, prefix.length() - 1));
|
||||
if (configurationSection == null) {
|
||||
log.warn("No keys configured, adding default");
|
||||
config.set(prefix, "dailyvotecrate", 0);
|
||||
config.set(prefix, "weeklyvotecrate", 0);
|
||||
config.set(prefix, "questcrate", 0);
|
||||
return;
|
||||
}
|
||||
Set<String> keys = configurationSection.getKeys(false);
|
||||
for (String key : keys) {
|
||||
CRATES.put(key, config.getInt(prefix, key, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class ARMOR_STAND_LIMIT {
|
||||
private static final String prefix = "armor_stand_limit.";
|
||||
|
||||
public static HashMap<String, Integer> LIMIT = new HashMap<>();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static void load() {
|
||||
LIMIT.clear();
|
||||
ConfigurationSection configurationSection = config.getConfigurationSection(prefix.substring(0, prefix.length() - 1));
|
||||
if (configurationSection == null) {
|
||||
log.warn("No limits configured, adding default");
|
||||
config.set(prefix, "default", 10);
|
||||
}
|
||||
Set<String> limits = configurationSection.getKeys(false);
|
||||
for (String key : limits) {
|
||||
LIMIT.put(key, config.getInt(prefix, key, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class LOCATOR_BAR {
|
||||
private static final String prefix = "locator_bar.";
|
||||
|
||||
public static double WAYPOINT_RECEIVE_RANGE = 200;
|
||||
public static double WAYPOINT_TRANSMIT_RANGE = 200;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static void load() {
|
||||
WAYPOINT_RECEIVE_RANGE = config.getDouble(prefix, "waypoint_receive_range", WAYPOINT_RECEIVE_RANGE);
|
||||
WAYPOINT_TRANSMIT_RANGE = config.getDouble(prefix, "waypoint_transmit_range", WAYPOINT_TRANSMIT_RANGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user