Search in sources :

Example 1 with MessageKeyConfigurationData

use of fr.xephi.authme.message.updater.MessageKeyConfigurationData in project AuthMeReloaded by AuthMe.

the class MessagesFileWriter method performWrite.

private void performWrite() {
    // Initialize ConfigMe classes
    MessageKeyConfigurationData configurationData = MessageUpdater.createConfigurationData();
    YamlFileResource resource = new MigraterYamlFileResource(file);
    PropertyReader reader = resource.createReader();
    configurationData.initializeValues(reader);
    // Store initial comments so we can add them back later
    List<String> initialComments = getInitialUserComments(configurationData);
    // Create property resource with new defaults, save with ConfigMe for proper sections & comments
    addMissingMessagesWithCommentMarker(reader, configurationData);
    resource.exportProperties(configurationData);
    // Go through the newly saved file and replace texts with comment marker to actual YAML comments
    // and add initial comments back to the file
    rewriteToFileWithComments(initialComments);
}
Also used : YamlFileResource(ch.jalu.configme.resource.YamlFileResource) MigraterYamlFileResource(fr.xephi.authme.message.updater.MigraterYamlFileResource) PropertyReader(ch.jalu.configme.resource.PropertyReader) MessageKeyConfigurationData(fr.xephi.authme.message.updater.MessageKeyConfigurationData) MigraterYamlFileResource(fr.xephi.authme.message.updater.MigraterYamlFileResource)

Aggregations

PropertyReader (ch.jalu.configme.resource.PropertyReader)1 YamlFileResource (ch.jalu.configme.resource.YamlFileResource)1 MessageKeyConfigurationData (fr.xephi.authme.message.updater.MessageKeyConfigurationData)1 MigraterYamlFileResource (fr.xephi.authme.message.updater.MigraterYamlFileResource)1