mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +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.
This commit is contained in:
parent
79fcb6baf4
commit
67b30c5ed5
1 changed files with 22 additions and 20 deletions
|
@ -7970,27 +7970,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ reader.expect('[');
|
||||
+ reader.skipWhitespace();
|
||||
+
|
||||
+ while (reader.canRead() && reader.peek() != ']') {
|
||||
+ reader.skipWhitespace();
|
||||
+
|
||||
+ final String property = reader.readString();
|
||||
+
|
||||
+ reader.skipWhitespace();
|
||||
+ reader.expect('=');
|
||||
+ reader.skipWhitespace();
|
||||
+
|
||||
+ final String value = reader.readString();
|
||||
+ ret.setString(property, value);
|
||||
+
|
||||
+ reader.skipWhitespace();
|
||||
+ if (reader.canRead()) {
|
||||
+ if (reader.peek() != ',') {
|
||||
+ // invalid character or ']'
|
||||
+ break;
|
||||
+ if (reader.canRead() && reader.peek() != ']') {
|
||||
+ while (reader.canRead()) {
|
||||
+ final String property = reader.readString();
|
||||
+
|
||||
+ reader.skipWhitespace();
|
||||
+ reader.expect('=');
|
||||
+ reader.skipWhitespace();
|
||||
+
|
||||
+ final String value = reader.readString();
|
||||
+ ret.setString(property, value);
|
||||
+
|
||||
+ reader.skipWhitespace();
|
||||
+ if (reader.canRead()) {
|
||||
+ if (reader.peek() != ',') {
|
||||
+ // invalid character or ']'
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ // skip ',' and move onto next entry
|
||||
+ reader.skip();
|
||||
+ }
|
||||
+
|
||||
+ // skip ',' and move onto next entry
|
||||
+ reader.peek();
|
||||
+
|
||||
+ reader.skipWhitespace();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
|
Loading…
Reference in a new issue