use of com.djrapitops.plan.settings.config.ConfigWriter in project Plan by plan-player-analytics.
the class ServerSettingsManager method checkDBForNewConfigSettings.
private void checkDBForNewConfigSettings(Database database) {
File configFile = files.getConfigFile();
long lastModified = configFile.exists() ? configFile.lastModified() : -1;
Optional<ServerUUID> serverUUID = serverInfo.getServerUUIDSafe();
if (!serverUUID.isPresent()) {
return;
}
Optional<Config> foundConfig = database.query(new NewerConfigQuery(serverUUID.get(), lastModified));
if (foundConfig.isPresent()) {
try {
new ConfigWriter(configFile.toPath()).write(foundConfig.get());
logger.info("The Config was updated to match one on the Proxy. Reload for changes to take effect.");
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}
use of com.djrapitops.plan.settings.config.ConfigWriter in project Plan by plan-player-analytics.
the class StoreConfigTransaction method extractConfigSettingLines.
private String extractConfigSettingLines(Config config) {
TextStringBuilder configTextBuilder = new TextStringBuilder();
List<String> lines = new ConfigWriter().createLines(config);
configTextBuilder.appendWithSeparators(lines, "\n");
return configTextBuilder.toString();
}
Aggregations