Class NbtConfigurationSerializer
java.lang.Object
com.comphenix.protocol.wrappers.nbt.io.NbtConfigurationSerializer
Serialize and deserialize NBT information from a configuration section.
Note that data types may be internally preserved by modifying the serialized name. This may be visible to the end-user.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NbtConfigurationSerializerA standard YAML serializer.static final StringThe default delimiter that is used to store the data type in YAML. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a serializer usingTYPE_DELIMITERas the default delimiter.NbtConfigurationSerializer(String dataTypeDelimiter) Construct a serializer using the given value as a delimiter. -
Method Summary
Modifier and TypeMethodDescription<TType> NbtWrapper<TType> deserialize(org.bukkit.configuration.ConfigurationSection root, String nodeName) Read a NBT tag from a root configuration.deserializeCompound(org.bukkit.configuration.file.YamlConfiguration root, String nodeName) Read a NBT compound from a root configuration.<T> NbtList<T> deserializeList(org.bukkit.configuration.file.YamlConfiguration root, String nodeName) Read a NBT compound from a root configuration.Retrieve the current data type delimiter.<TType> voidWrite the content of a NBT tag to a configuration section.toNodeValue(Object value, NbtType type)
-
Field Details
-
TYPE_DELIMITER
The default delimiter that is used to store the data type in YAML.- See Also:
-
DEFAULT
A standard YAML serializer.
-
-
Constructor Details
-
NbtConfigurationSerializer
public NbtConfigurationSerializer()Construct a serializer usingTYPE_DELIMITERas the default delimiter. -
NbtConfigurationSerializer
Construct a serializer using the given value as a delimiter.- Parameters:
dataTypeDelimiter- - the local data type delimiter.
-
-
Method Details
-
getDataTypeDelimiter
Retrieve the current data type delimiter.- Returns:
- The current data type delimiter.
-
serialize
public <TType> void serialize(NbtBase<TType> value, org.bukkit.configuration.ConfigurationSection destination) Write the content of a NBT tag to a configuration section.- Type Parameters:
TType- Type- Parameters:
value- - the NBT tag to write.destination- - the destination section.
-
deserialize
public <TType> NbtWrapper<TType> deserialize(org.bukkit.configuration.ConfigurationSection root, String nodeName) Read a NBT tag from a root configuration.- Type Parameters:
TType- Type- Parameters:
root- - configuration that contains the NBT tag.nodeName- - name of the NBT tag.- Returns:
- The read NBT tag.
-
deserializeCompound
public NbtCompound deserializeCompound(org.bukkit.configuration.file.YamlConfiguration root, String nodeName) Read a NBT compound from a root configuration.- Parameters:
root- - configuration that contains the NBT compound.nodeName- - name of the NBT compound.- Returns:
- The read NBT compound.
-
deserializeList
public <T> NbtList<T> deserializeList(org.bukkit.configuration.file.YamlConfiguration root, String nodeName) Read a NBT compound from a root configuration.- Type Parameters:
T- Type- Parameters:
root- - configuration that contains the NBT compound.nodeName- - name of the NBT compound.- Returns:
- The read NBT compound.
-
toNodeValue
-