diff options
author | SHsuperCM <shsupercm@gmail.com> | 2022-03-04 18:07:36 +0200 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2022-03-04 18:07:36 +0200 |
commit | d0bceef6b9287184f3d97c68f0429c86538d68eb (patch) | |
tree | dfc55a37cf846e50225246c84f20861a0c1391bc | |
parent | 90bb38ef08f0173ddfa9abb8b4ca2542f10af04a (diff) | |
download | CITResewn-d0bceef6b9287184f3d97c68f0429c86538d68eb.tar.gz CITResewn-d0bceef6b9287184f3d97c68f0429c86538d68eb.tar.bz2 CITResewn-d0bceef6b9287184f3d97c68f0429c86538d68eb.zip |
Moved property separator api into enum
5 files changed, 17 insertions, 6 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/builtin/conditions/ListCondition.java b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/builtin/conditions/ListCondition.java index 151119b..3b9a264 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/builtin/conditions/ListCondition.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/builtin/conditions/ListCondition.java @@ -39,7 +39,7 @@ public abstract class ListCondition<T extends CITCondition> extends CITCondition for (String conditionValue : delimiter.split(value.value())) { T condition = conditionSupplier.get(); - condition.load(new PropertyValue(value.keyMetadata(), conditionValue, value.delimiter(), value.position(), value.propertiesIdentifier(), value.packName()), properties); + condition.load(new PropertyValue(value.keyMetadata(), conditionValue, value.separator(), value.position(), value.propertiesIdentifier(), value.packName()), properties); conditions.add(condition); } diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertiesGroupAdapter.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertiesGroupAdapter.java index 7a8d2d4..4912a71 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertiesGroupAdapter.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertiesGroupAdapter.java @@ -92,7 +92,7 @@ public class PropertiesGroupAdapter extends PropertyGroup { int pos = linePos - multilineSkip; multilineSkip = 0; - this.put(pos, packName, identifier, key, keyMetadata, "=", builder.toString()); + this.put(pos, packName, identifier, key, keyMetadata, PropertySeparator.EQUALS, builder.toString()); } } return this; diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java index 75949db..1f21ed5 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java @@ -21,11 +21,11 @@ public abstract class PropertyGroup { public abstract PropertyGroup load(String packName, Identifier identifier, InputStream is) throws IOException, InvalidIdentifierException; - protected void put(int position, String packName, Identifier propertiesIdentifier, String key, String keyMetadata, String delimiter, String value) throws InvalidIdentifierException { + protected void put(int position, String packName, Identifier propertiesIdentifier, String key, String keyMetadata, PropertySeparator separator, String value) throws InvalidIdentifierException { Objects.requireNonNull(key); Objects.requireNonNull(value); - this.properties.computeIfAbsent(PropertyKey.of(key), id -> new LinkedHashSet<>()).add(new PropertyValue(keyMetadata, value, delimiter, position, propertiesIdentifier, packName)); + this.properties.computeIfAbsent(PropertyKey.of(key), id -> new LinkedHashSet<>()).add(new PropertyValue(keyMetadata, value, separator, position, propertiesIdentifier, packName)); } public Set<PropertyValue> get(String namespace, String... pathAliases) { @@ -52,7 +52,7 @@ public abstract class PropertyGroup { public PropertyValue getLastWithoutMetadataOrDefault(String defaultValue, String namespace, String... pathAliases) { PropertyValue property = getLastWithoutMetadata(namespace, pathAliases); if (property == null) - property = new PropertyValue(null, defaultValue, "=", -1, this.identifier, this.packName); + property = new PropertyValue(null, defaultValue, PropertySeparator.EQUALS, -1, this.identifier, this.packName); return property; } diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertySeparator.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertySeparator.java new file mode 100644 index 0000000..612d83f --- /dev/null +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertySeparator.java @@ -0,0 +1,11 @@ +package shcm.shsupercm.fabric.citresewn.pack.format; + +public enum PropertySeparator { + EQUALS("="); + + public final String separator; + + PropertySeparator(String separator) { + this.separator = separator; + } +} diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyValue.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyValue.java index 0294cb2..fe126d7 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyValue.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyValue.java @@ -4,7 +4,7 @@ import net.minecraft.util.Identifier; public record PropertyValue(String keyMetadata, String value, - String delimiter, + PropertySeparator separator, int position, Identifier propertiesIdentifier, String packName) { |