Class NbtConfigurationSerializer

java.lang.Object
com.comphenix.protocol.wrappers.nbt.io.NbtConfigurationSerializer

public class NbtConfigurationSerializer extends Object
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 Details

  • Constructor Details

    • NbtConfigurationSerializer

      public NbtConfigurationSerializer()
      Construct a serializer using TYPE_DELIMITER as the default delimiter.
    • NbtConfigurationSerializer

      public NbtConfigurationSerializer(String dataTypeDelimiter)
      Construct a serializer using the given value as a delimiter.
      Parameters:
      dataTypeDelimiter - - the local data type delimiter.
  • Method Details

    • getDataTypeDelimiter

      public String 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

      public Object toNodeValue(Object value, NbtType type)