Declare an inventory
This page describes how to declare and register an inventory in Java.
Create an InventoryDescriptor
public class CustomInventoryDescriptor implements InventoryDescriptor {
public static final String INVENTORY_ID = "custom-inventory";
private static final String INVENTORY_CONFIG_PATH = "menus/waypoint-icons-menu.yml";
private final Plugin plugin;
private final InventoryConfigDAO inventoryConfigDAO;
public CustomInventoryDescriptor(Plugin plugin, InventoryConfigDAO inventoryConfigDAO) {
this.plugin = plugin;
this.inventoryConfigDAO = inventoryConfigDAO;
}
@Override
public String getInventoryResourceFile() {
// Path to the configuration file of the inventory in the plugin's resources.
return INVENTORY_CONFIG_PATH;
}
@Override
public Path getInventoryConfigFile() {
// Path to the inventory configuration file in the plugin's folder.
return Paths.get(this.plugin.getDataFolder() + File.separator + INVENTORY_CONFIG_PATH);
}
@Override
public String getInventoryId() {
// This id must be unique. t is also recommended to only use the
// following characters: A-Z, a-z, 0-9, -, _.
return INVENTORY_ID;
}
@Override
public InventoryConfigDAO getInventoryConfigDAO() {
return this.inventoryConfigDAO;
}
}Create an InventoryProvider
Advanced concepts
Paginations
Placeholders
Enhancements
Hooks
Last updated