[x] You're using the latest build for your server version
[x] This isn't an issue caused by another plugin
[x] You've checked for duplicate issues
[x] You didn't use /reload
Describe the question
I'm trying to convert a json string into NBT, may be used in PLAY_SERVER_TILE_ENTITY_DATA.
The input json is given by the player so I need a deserializer.
API method(s) used
I had try NbtTextSerializer.DEFAULT#deserialize and NbtFactory#ofCompound
Expected behavior
Have a method that deserialize a complex json string into nms.nbt.CompoundTag
Code
I tried something like this :
if (text == null || text.isEmpty()) {
return NbtFactory.ofCompound("").getHandle();
}
byte[] bytes = text.getBytes(StandardCharsets.UTF_8);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
DataInputStream dataInput = new DataInputStream(byteArrayInputStream);
NbtWrapper<Object> wrapper = NbtTextSerializer.DEFAULT.getBinarySerializer().deserialize(dataInput); // Issue here
return wrapper.getHandle();
Make sure you're doing the following
/reload
Describe the question I'm trying to convert a json string into NBT, may be used in PLAY_SERVER_TILE_ENTITY_DATA. The input json is given by the player so I need a deserializer.
API method(s) used I had try NbtTextSerializer.DEFAULT#deserialize and NbtFactory#ofCompound
Expected behavior Have a method that deserialize a complex json string into nms.nbt.CompoundTag
Code I tried something like this :
Additional context This is for Skript-Packet.