-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
This server is running CraftBukkit version dev-Spigot-018b9a0-f3f3094 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
-
Yes
The deserializer for the PersistentDataContainer (https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java) is rather strict currently regarding the types of data it accepts: It accepts Maps, Lists, and Strings with different kinds of contents.
Considering that serialized ItemStacks can also be specified by users in configurations, it might make sense to also accept some of the other types of data that snakyaml implicitly produces when parsing a yaml configuration.
For instance, if a user specifies
test:integer: 123
instead of the expected
test:integer: '123i'
snakeyaml will produce an integer for the first value, which the deserializer will not accept and then throw an exception.
The suggestion is to also accept numbers and boolean values here. The deserializer could convert these to Strings and then pass them to the underlying MojangsonParser. For integers this will produce expected integer NBT values, for booleans this will produce the corresponding byte NBT values.
For reference, this came up during a discussion on some other PR: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/777/overview?commentId=7101