Registering a custom inventory or container

Some plugins have their own inventories that can hold items (backpacks, vaults, banks...). Banco cannot use those by default. That's where BancoInventory and BancoContainer are useful.

Difference between BancoInventory and BancoContainer

get(uuid)
Example

BancoInventory

Must return an Inventory

BancoContainer

Must return a modifiable list of ItemStack

Using StorageManager to register a BancoInventory or BancoContainer

Every inventory and container must be registered by using StorageManager:

BancoInventory customInventory = new CustomInventory();
BancoContainer customContainer = new CustomContainer();

Banco.get().getStorageManager().registerStorage(customInventory);
Banco.get().getStorageManager().registerStorage(customContainer);

And can be unregistered at any time with unregisterStorage(bancoStorage):

Banco.get().getStorageManager().unregisterStorage(customInventory);
Banco.get().getStorageManager().unregisterStorage(customContainer);

Last updated