mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-23 00:39:16 +00:00
some config updates
This commit is contained in:
@@ -39,11 +39,7 @@ public final class ReloadCommand extends DivineSubCommandPermission {
|
||||
|
||||
MinecraftServer server = ((CraftServer) sender.getServer()).getServer();
|
||||
|
||||
try {
|
||||
DivineConfig.init((File) server.options.valueOf("divinemc-settings"));
|
||||
} catch (IOException e) {
|
||||
MinecraftServer.LOGGER.error("Failed to reload DivineMC config", e);
|
||||
}
|
||||
DivineConfig.init((File) server.options.valueOf("divinemc-settings"));
|
||||
|
||||
for (ServerLevel level : server.getAllLevels()) {
|
||||
try {
|
||||
|
||||
@@ -59,21 +59,30 @@ public class DivineConfig {
|
||||
return convertToBukkit(config);
|
||||
}
|
||||
|
||||
public static void init(File configFile) throws IOException {
|
||||
DivineConfig.configFile = configFile;
|
||||
if (configFile.exists()) {
|
||||
try {
|
||||
config.load(configFile);
|
||||
} catch (InvalidConfigurationException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
public static void init(File configFile) {
|
||||
try {
|
||||
long begin = System.nanoTime();
|
||||
LOGGER.info("Loading config...");
|
||||
|
||||
getInt("version", CONFIG_VERSION);
|
||||
config.options().header(HEADER);
|
||||
DivineConfig.configFile = configFile;
|
||||
if (configFile.exists()) {
|
||||
try {
|
||||
config.load(configFile);
|
||||
} catch (InvalidConfigurationException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
readConfig(DivineConfig.class, null);
|
||||
checkExperimentalFeatures();
|
||||
getInt("version", CONFIG_VERSION);
|
||||
config.options().header(HEADER);
|
||||
|
||||
readConfig(DivineConfig.class, null);
|
||||
checkExperimentalFeatures();
|
||||
|
||||
LOGGER.info("Config loaded in {}ms", (System.nanoTime() - begin) / 1_000_000);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Failed to load config", e);
|
||||
}
|
||||
}
|
||||
|
||||
static void readConfig(Class<?> clazz, Object instance) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user