Declare an inventory
This page describes how to declare and register an inventory in Java.
In CraftVentory, an inventory is declared using the InventoryDescriptor
interface. This interface is then mapped into an InventoryProvider
which is a bridge between an InventoryConfig
and an in-game inventory.
Create an InventoryDescriptor
Using the InventoryDescriptor
interface, you can declare some properties of your inventory: the configuration file to load, the inventory id, its hooks, paginations and enhancements. The following code shows a basic implementation of this interface:
The interface also contains default methods you can redefine to register pagination providers, hooks and enhancements. These methods are not shown in the example above.
Create an InventoryProvider
An InventoryProvider
encapsulates an InventoryDescriptor
to create and provide an inventory. To be reused, inventory providers are registered in an InventoryService
. The following code illustrates how to create and register a provider using a descriptor:
Advanced concepts
Paginations
Placeholders
Enhancements
Hooks
Last updated