diff options
author | Joseph Burton <[email protected]> | 2024-05-10 00:31:58 -0700 |
---|---|---|
committer | Spottedleaf <[email protected]> | 2024-05-10 00:32:31 -0700 |
commit | 2df1dace32990fbc0d63caa0552b931e88aff4b2 (patch) | |
tree | 8c8eb7b19fce560ee7640a4ac3fb363c3a48b2c7 | |
parent | b56e92f3d4c263486210e7a082a98b301b181eef (diff) | |
download | Paper-2df1dace32990fbc0d63caa0552b931e88aff4b2.tar.gz Paper-2df1dace32990fbc0d63caa0552b931e88aff4b2.zip |
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.
-rw-r--r-- | patches/server/0976-Rewrite-dataconverter-system.patch | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/patches/server/0976-Rewrite-dataconverter-system.patch b/patches/server/0976-Rewrite-dataconverter-system.patch index 0abf2badef..f2ca0c980f 100644 --- a/patches/server/0976-Rewrite-dataconverter-system.patch +++ b/patches/server/0976-Rewrite-dataconverter-system.patch @@ -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 new file mode 100644 -index 0000000000000000000000000000000000000000..0f961bca2ab2cd9e93cb7c23951ac6b867cdd04e +index 0000000000000000000000000000000000000000..2cf90187ea8bc54b06cebd54ae2582ca66d91132 --- /dev/null +++ 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; + +import ca.spottedleaf.dataconverter.types.ListType; @@ -7970,27 +7970,29 @@ index 0000000000000000000000000000000000000000..0f961bca2ab2cd9e93cb7c23951ac6b8 + 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(); + } + } + @@ -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 new file mode 100644 -index 0000000000000000000000000000000000000000..29d256c2f5d5e338dc7abeb82c0f1ae99ee1edf7 +index 0000000000000000000000000000000000000000..40f9b8f2a3d0b01dc97472f34c441321a0e33079 --- /dev/null +++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3818.java @@ -0,0 +1,339 @@ |