This is a simplistic Menu API made for the Spigot API, with built-in pagination, actions, and more.
- Menu fillers are currently in development, and issues may occur.
You have to register the MenuHandler
object somewhere, preferably inside of the main class, for example:
@Override
public void onEnable() {
new MenuHandler(this);
// your code
}
You have to make a class extending the Menu class (or PaginatedMenu), or make a new anonymous class, for example:
import io.github.nosequel.menu.buttons.Button;
import io.github.nosequel.menu.pagination.PaginatedMenu;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.List;
class ExampleClass {
public ExampleClass(Player player) {
final PaginatedMenu menu = new PaginatedMenu(player, "example", 18) {
@Override
public void tick() {
for (int i = 0; i < 27; i++) {
this.buttons[i] = new Button(Material.ENDER_PEARL)
.setDisplayName("&aSlot: " + i)
.setClickAction(event -> event.setCancelled(true));
}
}
};
menu.updateMenu();
}
}
import io.github.nosequel.menu.buttons.Button;
import io.github.nosequel.menu.pagination.PaginatedMenu;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.List;
public class ExampleMenu extends PaginatedMenu {
public ExampleMenu(Player player) {
super(player, "example", 18, 4);
}
@Override
public void tick() {
for(int i = 0; i < 27; i++) {
this.buttons[i] = new Button(Material.ENDER_PEARL)
.setDisplayName("&aSlot: " + i)
.setClickAction(event -> event.setCancelled(true));
}
}
}
new ExampleMenu(player).updateMenu();
PaginatedMenu#setNavigationPosition(NavigationPosition)
PaginatedMenu#setNextPageButton(Button)
PaginatedMenu#setPreviousPageButton(Button)
Menu#addFiller(FillingType)