/** * Run all warning checks and alter the configuration file if necessary (GlobalConfig, Deprecated, Moved). * @param file * @param configName */ public static void processPaths(File file, String configName, boolean isWorldConfig) { ConfigFile config = new ConfigFile(); try { config.load(file); ConfigFile newConfig = processPaths(config, configName, isWorldConfig); if (newConfig != null) { config = newConfig; try{ config.save(file); } catch(Throwable t) { // Do log this one. StaticLog.logSevere("Failed to save configuration (" + configName + ") with changes: " + t.getClass().getSimpleName()); StaticLog.logSevere(t); } } } catch (FileNotFoundException e) { } catch (IOException e) { } catch (InvalidConfigurationException e) { } }
final int maxBuildContained = defaultConfig.getMaxLastChangedBuildNumber(); PathUtils.processPaths(globalFile, "global config", false); final ConfigFile globalConfig = new ConfigFile(); globalConfig.setDefaults(defaultConfig); PathUtils.processPaths(worldFile, "world " + worldEntry.getKey(), true); final ConfigFile worldConfig = new ConfigFile(); worldConfig.setDefaults(worldDefaults);