Package valorless.havenbags.features
Class CustomData
java.lang.Object
valorless.havenbags.features.CustomData
Manages applying configured "custom data" entries onto HavenBags items.
Custom data can be written either to:
- NBT via
NBT(typically for compatibility with systems reading raw item NBT), or - PDC (PersistentDataContainer) via Bukkit's
PersistentDataContainerAPI.
The definitions are loaded from the plugin config under the custom-data section.
Entries are grouped by bag size (slot count). When a bag is updated, only models matching
the bag's size (stored in PDC under key "size") are applied.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classModel representing one configured custom-data entry for a specific bag size.static enumStorage backend for a configured data entry. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinit()LoadsdataModelsfromMain.config.static voidreload()Clears the cached models and reloads them from config.static voidupdateBag(org.bukkit.inventory.ItemStack bag) Applies all configured custom-data entries relevant to this bag's size.
-
Constructor Details
-
CustomData
public CustomData()
-
-
Method Details
-
init
public static void init()LoadsdataModelsfromMain.config.Expected config structure:
custom-data: "9": example: plugin: "HavenBags" key: "some_key" type: "NBT" | "PDC" value: ... pdc-type: "STRING" | "INTEGER" | "DOUBLE" | "BOOLEAN" | "FLOAT" | "UUID" # only for PDC -
reload
public static void reload()Clears the cached models and reloads them from config. -
updateBag
public static void updateBag(org.bukkit.inventory.ItemStack bag) Applies all configured custom-data entries relevant to this bag's size.The bag size is read from the bag's PDC key
"size".- Parameters:
bag- the bag item to update (mutated in-place)
-