Data bagData
= HavenBagsAPI.
createBag(creationObject
);// Create & save new bag. bagData.
setAutoPickup("mining"); bagData.
setAutoSort(true);// Any setters will automatically mark the data for saving. }
private Data getBagData
(ItemStack item
){ if(HavenBagsAPI.
isBag(item
)){// Make sure the item is a bag. String bagUUID
= HavenBagsAPI.
getBagUUID(item
);// Get the bag's UUID. return HavenBagsAPI.
getBag(bagUUID
);// Fetch the bag's Data. } elsereturnnull;// Return null if the item is not a bag. }