diff --git a/serializers-json5/src/main/java/org/quiltmc/config/api/serializers/Json5Serializer.java b/serializers-json5/src/main/java/org/quiltmc/config/api/serializers/Json5Serializer.java index 3e55271..2efc062 100644 --- a/serializers-json5/src/main/java/org/quiltmc/config/api/serializers/Json5Serializer.java +++ b/serializers-json5/src/main/java/org/quiltmc/config/api/serializers/Json5Serializer.java @@ -130,7 +130,7 @@ private void serialize(JsonWriter writer, ValueTreeNode node) throws IOException Optional defaultComment = SerializerUtils.getDefaultValueString(defaultValue); if (defaultComment.isPresent()) { - writer.comment("default: " + defaultComment); + writer.comment("default: " + defaultComment.get()); } String name = SerializerUtils.getSerializedName(trackedValue); diff --git a/serializers-toml/src/main/java/org/quiltmc/config/api/serializers/TomlSerializer.java b/serializers-toml/src/main/java/org/quiltmc/config/api/serializers/TomlSerializer.java index ba469ff..00c01a4 100644 --- a/serializers-toml/src/main/java/org/quiltmc/config/api/serializers/TomlSerializer.java +++ b/serializers-toml/src/main/java/org/quiltmc/config/api/serializers/TomlSerializer.java @@ -27,7 +27,6 @@ import org.quiltmc.config.api.Constraint; import org.quiltmc.config.api.MarshallingUtils; import org.quiltmc.config.api.Serializer; -import org.quiltmc.config.api.annotations.Alias; import org.quiltmc.config.api.annotations.Comment; import org.quiltmc.config.api.values.ConfigSerializableObject; import org.quiltmc.config.api.values.TrackedValue; @@ -36,7 +35,6 @@ import org.quiltmc.config.api.values.ValueMap; import org.quiltmc.config.api.values.ValueTreeNode; import org.quiltmc.config.impl.util.SerializerUtils; -import org.quiltmc.config.impl.values.ValueKeyImpl; import java.io.InputStream; import java.io.OutputStream; @@ -148,9 +146,7 @@ private static CommentedConfig write(Config config, CommentedConfig commentedCon } Optional defaultValueComment = SerializerUtils.getDefaultValueString(defaultValue); - if (defaultValueComment.isPresent()) { - comments.add("default: " + defaultValueComment); - } + defaultValueComment.ifPresent(s -> comments.add("default: " + s)); commentedConfig.add(toNightConfigSerializable(key), convertAny(value.getRealValue())); } else {