From 8dec88d78013323403cdca16984bdfc5d1c4ebf1 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sun, 28 Apr 2024 21:47:54 +0200 Subject: [PATCH] Roll back adaptions for ConfigMe 1.4 --- .../message/updater/MigraterYamlFileResource.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/xephi/authme/message/updater/MigraterYamlFileResource.java b/src/main/java/fr/xephi/authme/message/updater/MigraterYamlFileResource.java index bb96aec77..b0122215b 100644 --- a/src/main/java/fr/xephi/authme/message/updater/MigraterYamlFileResource.java +++ b/src/main/java/fr/xephi/authme/message/updater/MigraterYamlFileResource.java @@ -2,7 +2,6 @@ package fr.xephi.authme.message.updater; import ch.jalu.configme.resource.PropertyReader; import ch.jalu.configme.resource.YamlFileResource; -import org.jetbrains.annotations.NotNull; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; @@ -20,12 +19,12 @@ public class MigraterYamlFileResource extends YamlFileResource { } @Override - public @NotNull PropertyReader createReader() { + public PropertyReader createReader() { return MessageMigraterPropertyReader.loadFromFile(getFile()); } @Override - protected @NotNull Yaml createNewYaml() { + protected Yaml createNewYaml() { if (singleQuoteYaml == null) { DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); @@ -37,4 +36,12 @@ public class MigraterYamlFileResource extends YamlFileResource { } return singleQuoteYaml; } + + // Because we set the YAML object to put strings in single quotes, this method by default uses that YAML object + // and also puts all paths as single quotes. Override to just always return the same string since we know those + // are only message names (so never any conflicting strings like "true" or "0"). + @Override + protected String escapePathElementIfNeeded(String path) { + return path; + } }