use of net.glowstone.util.GlowServerIcon in project Glowstone by GlowstoneMC.
the class GlowServer method loadConfig.
/**
* Load the server configuration.
*/
private void loadConfig() {
config.load();
worldConfig.load();
// modifiable values
spawnRadius = config.getInt(Key.SPAWN_RADIUS);
whitelistEnabled = config.getBoolean(Key.WHITELIST);
idleTimeout = config.getInt(Key.PLAYER_IDLE_TIMEOUT);
maxPlayers = config.getInt(Key.MAX_PLAYERS);
// special handling
warnState = WarningState.value(config.getString(Key.WARNING_STATE));
try {
defaultGameMode = GameMode.valueOf(config.getString(Key.GAMEMODE));
} catch (IllegalArgumentException | NullPointerException e) {
defaultGameMode = GameMode.SURVIVAL;
}
// server icon
defaultIcon = new GlowServerIcon();
try {
File serverIconFile = config.getFile(SERVER_ICON_FILE);
if (serverIconFile.isFile()) {
defaultIcon = new GlowServerIcon(serverIconFile);
} else {
try {
File vanillaServerIcon = new File(SERVER_ICON_FILE);
if (vanillaServerIcon.isFile()) {
// Import from Vanilla
ConsoleMessages.Info.Icon.IMPORT.log(SERVER_ICON_FILE);
Files.copy(vanillaServerIcon.toPath(), serverIconFile.toPath());
defaultIcon = new GlowServerIcon(serverIconFile);
}
} catch (Exception e) {
ConsoleMessages.Warn.Icon.LOAD_FAILED_IMPORT.log(e, SERVER_ICON_FILE);
}
}
} catch (Exception e) {
ConsoleMessages.Warn.Icon.LOAD_FAILED.log(e, SERVER_ICON_FILE);
}
}
Aggregations