mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-04 22:22:18 -07: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.
This commit is contained in:
@@ -7970,27 +7970,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ 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();
|
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
Reference in New Issue
Block a user