3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Fix DataConverter ConverterParticleToNBT.parseProperties

- The old code was using `StringReader.peek()` in a place where it meant to be `StringReader.skip()`.
- The vanilla code allows a trailing comma, but only if there is no whitespace between it and the closing bracket, which is a bit weird. I think that's a bug and it shouldn't allow trailing commas, but if you disagree then only the first issue needs to be fixed.
Dieser Commit ist enthalten in:
Joseph Burton 2024-05-10 00:31:58 -07:00 committet von Spottedleaf
Ursprung b56e92f3d4
Commit 2df1dace32

Datei anzeigen

@ -7908,10 +7908,10 @@ index 0000000000000000000000000000000000000000..769dd8447976b66dcfc36283ede4ae16
+} +}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/particle/ConverterParticleToNBT.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/particle/ConverterParticleToNBT.java diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/particle/ConverterParticleToNBT.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/particle/ConverterParticleToNBT.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0f961bca2ab2cd9e93cb7c23951ac6b867cdd04e index 0000000000000000000000000000000000000000..2cf90187ea8bc54b06cebd54ae2582ca66d91132
--- /dev/null --- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/particle/ConverterParticleToNBT.java +++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/particle/ConverterParticleToNBT.java
@@ -0,0 +1,268 @@ @@ -0,0 +1,270 @@
+package ca.spottedleaf.dataconverter.minecraft.converters.particle; +package ca.spottedleaf.dataconverter.minecraft.converters.particle;
+ +
+import ca.spottedleaf.dataconverter.types.ListType; +import ca.spottedleaf.dataconverter.types.ListType;
@ -7970,27 +7970,29 @@ index 0000000000000000000000000000000000000000..0f961bca2ab2cd9e93cb7c23951ac6b8
+ reader.expect('['); + reader.expect('[');
+ reader.skipWhitespace(); + reader.skipWhitespace();
+ +
+ while (reader.canRead() && reader.peek() != ']') { + if (reader.canRead() && reader.peek() != ']') {
+ reader.skipWhitespace(); + while (reader.canRead()) {
+ + final String property = reader.readString();
+ final String property = reader.readString(); +
+ + reader.skipWhitespace();
+ reader.skipWhitespace(); + reader.expect('=');
+ reader.expect('='); + reader.skipWhitespace();
+ reader.skipWhitespace(); +
+ + final String value = reader.readString();
+ final String value = reader.readString(); + ret.setString(property, value);
+ ret.setString(property, value); +
+ + reader.skipWhitespace();
+ reader.skipWhitespace(); + if (reader.canRead()) {
+ if (reader.canRead()) { + if (reader.peek() != ',') {
+ if (reader.peek() != ',') { + // invalid character or ']'
+ // invalid character or ']' + break;
+ break; + }
+
+ // skip ',' and move onto next entry
+ reader.skip();
+ } + }
+ +
+ // skip ',' and move onto next entry + reader.skipWhitespace();
+ reader.peek();
+ } + }
+ } + }
+ +
@ -22437,7 +22439,7 @@ index 0000000000000000000000000000000000000000..f50b81d931a1908d405bb72e0679983a
+} +}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3818.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3818.java diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3818.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3818.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..29d256c2f5d5e338dc7abeb82c0f1ae99ee1edf7 index 0000000000000000000000000000000000000000..40f9b8f2a3d0b01dc97472f34c441321a0e33079
--- /dev/null --- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3818.java +++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3818.java
@@ -0,0 +1,339 @@ @@ -0,0 +1,339 @@