1 minute estimated read time

Inventory

Below is an example of a normal one-paged inventory (9x3 slots).

MyInventory.java
@VitalInventory.Info(type = VitalInventory.Type.GENERIC_9X3, name = "My inventory")
public class MyInventory extends VitalInventory {
    @Override
    public void onUpdate() {
        // This item doesn’t do anything.
        setItem(0, new ItemStack(Material.STICK));
    }

    @Override
    public void onUpdate(Player player) {
        // This item can be clicked.
        setItem(1, new ItemStack(Material.COBBLESTONE), (e) -> {
            // Do something when this item is clicked.
            player.sendMessage("You have clicked the item in slot 1");
        });
    }
}

Found an issue?

Help us improve the documentation by reporting typos, missing information, or anything confusing.

Don't worry, we will auto-fill most of the annoying fields.

Create GitHub issue

This site and the Vital framework were built with ❤️ by Mike Neumann