Create simple menu

Here we gonna talk about how create a menu

Methods

onCloseMenu [OVERRIDE]

This event is called when a player close menu

protected abstract void onCloseMenu(Player player);
onOpenMenu [OVERRIDE]

This event is called when a player open menu

protected abstract void onOpenMenu(Player player);
addItem

There is 2 system to add any items : initially and dynamically.

Dynamically

This will add item only for 1 specific user. If you call this method in constructor, your constructor gonna crash. So use this method on events

protected void addItem(Player player, IGuiItem item, int slot) throws PlayerNotReaderException

Initially

this method must be used in constructor. It will place item in all menus for all players.

protected void addItem(IGuiItem item, int slot)
refreshPage

This method can be called to refresh a player menu.

protected void refreshPage(Player player)

Code example

What's simple menu ?

simple menu is only 1 chest page menu. It does not allow you to create several page.

Create your first menu

Now you have your menu, let's add it to menu system.

Add items in menu

Refresh user page

Last updated