Class CustomData.DataModel

java.lang.Object
valorless.havenbags.features.CustomData.DataModel
Enclosing class:
CustomData

public static class CustomData.DataModel extends Object
Model representing one configured custom-data entry for a specific bag size.

For PDC entries, pluginName is used to resolve the owning plugin namespace for the created NamespacedKey. For NBT entries, only key and value are used.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Storage backend for this model.
    Key used for NBT tag name or PDC NamespacedKey.getKey() depending on dataType.
    Plugin name used for PDC namespacing.
    int
    Bag size (slot count) this model applies to.
    org.bukkit.persistence.PersistentDataType
    PDC type hint used when writing to the PersistentDataContainer.
    Configured value to write.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DataModel(int slots)
    Creates a model for a given bag size.
  • Method Summary

    Modifier and Type
    Method
    Description
    Debug-friendly string representation of the model.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • slots

      public int slots
      Bag size (slot count) this model applies to.

      Different bag sizes can have different sets of custom-data entries.

    • pluginName

      public String pluginName
      Plugin name used for PDC namespacing.

      This is resolved via Bukkit.getPluginManager() and used to create a NamespacedKey. Ignored for CustomData.DataType.NBT.

    • key

      public String key
      Key used for NBT tag name or PDC NamespacedKey.getKey() depending on dataType.
    • value

      public Object value
      Configured value to write.

      For NBT this may be String/Integer/Double/Boolean/Float/UUID. For PDC this should match type.

    • type

      public org.bukkit.persistence.PersistentDataType type
      PDC type hint used when writing to the PersistentDataContainer. Defaults to PersistentDataType.STRING.
    • dataType

      public CustomData.DataType dataType
      Storage backend for this model.
  • Constructor Details

    • DataModel

      public DataModel(int slots)
      Creates a model for a given bag size.
      Parameters:
      slots - bag size (slot count)
  • Method Details

    • toString

      public String toString()
      Debug-friendly string representation of the model. Type is nulled for NBT entries since they don't use it, and shown for PDC entries to clarify the expected value type.
      Overrides:
      toString in class Object