This page illustrates how data can be stored and shared between inventories.
The InventoryStorage
interface enables to store additional data related to an inventory. CraftVentory provides two types of storage for these additional data : local storage and shared storage.
Local storage is a type of storage specific to a single inventory. That means that all stored data is accessible only for the inventory that holds them.
This type of storage is accessible through the CraftVentory#getLocalStorage()
method.
Shared storage is a type of storage shared between all the inventories in the player's inventory history. That means that stored data is accessible to all the inventories in the history.
This type of storage is accessible through the InventoryViewManager#getSharedStorage()
method.
When the player's inventory history is reset, the shared storage is reset too.