πŸ–₯️Menus

Paginated and non-paginated inventories with buttons, items, and more...

Creating a Menu

If you'd like to make a normal non-paginated menu:

final Component title = TextStyle.style("<gray><bold>My Menu");
Menu menu = Menu.menu(title, 54);
// OR:
menu = Menu.menu(title, /* width */ 9, /* height */ 6);
// 54 is an example size, you can do whatever you want.

A paginated menu would be the same but instead of using:

Menu.menu(...)

You would use:

PaginatedMenu.menu(...)

Adding Items to a Menu

Now that you have a menu instance, you can now add items to it freely.

final MenuBase<?> menu = /* ... */;

// If you're using a normal menu: 
menu.item(
    slot,
    ItemBuilder.item(Material.DIAMOND)
);

// If you're using a paginated menu: 
menu.item(
    PaginatedSlot.paginatedSlot(
        slot,
        page
    ),
    ItemBuilder.item(Material.DIAMOND)
);

This is not a button, this a item that can be taken and put back.

Adding Buttons to a Menu

Buttons are items that are clickable. You can tell what the button to do after it's clicked on.

Inventory Events

If you'd like to add custom implementation for a event listener for when the inventory gets closed or when inventory drag event gets caused you can do the following:

Opening the Menu

Borders

If you want to create a border quickly, here's an example:

Filling

If you want to fill a bunch of slots with the same item, you can use the following example to help you:

Example

Last updated

Was this helpful?