Fix reading of explicit int array entries

See https://github.com/KyoriPowered/adventure/pull/460
This commit is contained in:
Nassim Jahnke 2021-10-02 11:27:18 +02:00
parent 0bcaf3e422
commit 68c63d20ed
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 4 additions and 2 deletions

View File

@ -265,13 +265,15 @@ final class TagStringReader {
Tag result = null;
try {
switch (Character.toLowerCase(current)) { // try to read and return as a number
// case Tokens.TYPE_INTEGER: // handled below, ints are ~special~
case Tokens.TYPE_BYTE:
result = new ByteTag(Byte.parseByte(builder.toString()));
break;
case Tokens.TYPE_SHORT:
result = new ShortTag(Short.parseShort(builder.toString()));
break;
case Tokens.TYPE_INT:
result = new IntTag(Integer.parseInt(builder.toString()));
break;
case Tokens.TYPE_LONG:
result = new LongTag(Long.parseLong(builder.toString()));
break;

View File

@ -35,6 +35,7 @@ public class NBTTagTest {
readString("{id:[I;1,2, 3, 4,5]}"); // >=1.11
readString("{id:1b,b:true}");
readString("{id:[L;1l,2L,3L]}"); // >=1.11
readString("{id:[I;1i,2I,3I]}");
readString("{id:'minecraft:stone'}"); // >=1.13
readString("{id:1,id:2}");
readString("{id:-20b,test:3.19f}");
@ -47,7 +48,6 @@ public class NBTTagTest {
//TODO fix legacy < 1.12
// readString("{id:minecraft:stone}");
// readString("{id:[I;1i,2I,3I]}");
// readString("{id:[1,2, 3, 4,5]}");
}
}