public class NBTson
extends java.lang.Object
NBTson.NBTsonBuilder
for creating a new instance of this class.
NBTson supports reading deserializable and writing serializable objects to
ItemStacks. ItemStacks support custom NBT tags where as Entities and TileEntities only
handle recognizable NBT tags.
See the read(ItemStack, String, Class)
for reading a serialized object from
an item and write(ItemStack, String, Object)
for writing an object to an item.Modifier and Type | Class and Description |
---|---|
static class |
NBTson.NBTsonBuilder
Following the Builder pattern this class is designed for chaining registration calls
for all supported serializers and deserializers that will be required by the constructed
NBTson instance. |
Modifier and Type | Method and Description |
---|---|
<T> T |
read(org.bukkit.inventory.ItemStack item,
java.lang.String key,
java.lang.Class<T> type)
Read an object from the item at the given key.
|
void |
write(org.bukkit.inventory.ItemStack item,
java.lang.String key,
java.lang.Object data)
Write an object to the itemstack.
|
public <T> T read(org.bukkit.inventory.ItemStack item, java.lang.String key, java.lang.Class<T> type)
T
- the type of the object being deserialized.item
- the ItemStack containing the object.key
- the key that the object was originally written to.type
- the class of the object to read.public void write(org.bukkit.inventory.ItemStack item, java.lang.String key, java.lang.Object data)
item
- the ItemStack containing the object.key
- the key that the object is written to. It can be used to
later retrieve the data with read(ItemStack, String, Class)
data
- the object to write to the item.NBTSerializationException
- if the object cannot be serialized