-
Notifications
You must be signed in to change notification settings - Fork 0
Basic menu
Nucker edited this page Oct 24, 2021
·
1 revision
This page will guide you through creating a basic menu. We will be using the spigot module for this, however same methods apply in the adventure module.
We need to first create are menu:
Menu menu = new Menu(2, "&0My menu");The first parameter is the amount of rows in the menu. (Aka it calculates the amount of slots needed for the inventory by doing rows * 9.)
You can also extend the menu class (this tutorial wont do this but it is always an option):
public class MyMenu extends Menu {
public MyMenu() {
super(2, "&0My menu");
// Do stuff to build inventory such as adding items
}
}We can first add items. There are two methods:
menu.addItem(item); // Will add the item to the next available slot
menu.setItem(item, 4); // Will put the item in the given slotThe biggest reason to use a gui or menu library is so you can easily create things such as clickable items (buttons) without having to have a separate class for listening.