VCONTAINER API
Methods
This page collects the public API methods for item storage, GUI access, persistence, storage blocks, members, and backend information.
Available Methods
| Method | Returns | Description |
|---|---|---|
addItem(Player player, ItemStack item) | void | Adds an item to the player's virtual container. |
addItem(UUID ownerId, ItemStack item) | void | Adds an item to a container by owner UUID. |
removeItem(Player player, ItemStack item) | void | Removes a matching item from the player's container. |
removeItem(UUID ownerId, ItemStack item) | void | Removes a matching item from a container by owner UUID. |
takeItem(UUID ownerId, ItemStack item, int amount) | int | Attempts to withdraw a specific amount and returns how many items were removed. |
getItems(Player player) | List<ItemStack> | Returns the stored items for the player's container. |
getItems(UUID ownerId) | List<ItemStack> | Returns stored items by owner UUID. |
containsItem(Player player, ItemStack item) | boolean | Checks whether the player's container contains a matching item. |
clear(Player player) | void | Clears the player's virtual container. |
clear(UUID ownerId) | void | Clears a virtual container by owner UUID. |
openContainer(Player player) | void | Opens the player's own container GUI. |
openContainer(Player viewer, UUID ownerId, String ownerName) | void | Opens another owner's container for a viewer. |
openAdminContainer(Player admin, Player owner) | void | Opens an admin-facing container view for another player. |
flush() | void | Flushes pending container and storage block changes to the active backend. |
createPersonalStorageBlockItem(int amount) | ItemStack | Creates the configured personal storage block item. |
isPersonalStorageBlockItem(ItemStack item) | boolean | Checks whether an item is a VContainer personal storage block item. |
createGlobalStorageBlock(Block block) | boolean | Registers a world block as a global storage block. |
createPersonalStorageBlock(Block block, Player owner) | boolean | Registers a world block as a player-owned personal storage block. |
removeGlobalStorageBlock(Block block) | boolean | Removes a registered global storage block. |
removePersonalStorageBlock(String storageKey, boolean keepBlock) | boolean | Removes a personal storage block by key and optionally leaves the world block in place. |
isStorageBlock(Block block) | boolean | Checks whether a world block is registered as a VContainer storage block. |
getStorageBlock(Block block) | Optional<StorageBlockInfo> | Looks up storage block metadata from a world block. |
getStorageBlock(String storageKey) | Optional<StorageBlockInfo> | Looks up storage block metadata by storage key. |
getStorageBlocks() | Collection<StorageBlockInfo> | Returns every registered storage block. |
getGlobalStorageBlocks() | Collection<StorageBlockInfo> | Returns registered global storage blocks. |
getPersonalStorageBlocks() | Collection<StorageBlockInfo> | Returns registered personal storage blocks. |
canAccessStorageBlock(Player player, String storageKey) | boolean | Checks owner/member access for a storage block. |
isStorageBlockOwner(Player player, String storageKey) | boolean | Checks whether the player owns the storage block. |
canPlacePersonalStorageBlock(Block block, Player owner) | boolean | Checks placement rules and chunk limits for a personal storage block. |
getPersonalStorageBlockChunkLimit() | int | Returns the configured per-chunk personal storage block limit. |
addStorageBlockMember(String storageKey, UUID memberId) | boolean | Adds a member to a personal storage block. |
removeStorageBlockMember(String storageKey, UUID memberId) | boolean | Removes a member from a personal storage block. |
setStorageBlockMember(String storageKey, UUID memberId, boolean member) | boolean | Adds or removes a storage block member based on the boolean value. |
getStorageBlockKey(Block block) | String | Returns the storage key for a registered world block. |
Related Events
ContainerAddItemEventContainerWithdrawItemEventStorageBlockHopperTransferEvent
Behavior Notes
- Storage block lookups return
StorageBlockInfometadata with key, type, owner, and member data. flush()is useful after batch changes; normal automatic persistence still runs on the plugin schedule.- Member methods apply to personal storage blocks and use the storage key returned by block lookup methods.