Create simple menu
Here we gonna talk about how create a menu
Methods
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.
To init GuiManager, please refer to this documentation :
Add items in menu
Refresh user page
This version is outdated. Please download latest release with versioning check system.
Some methods explained before does not exist in this version.
What's important ?
There is 3 methods very important:
Constructor function
Init function
Update function
Constructor
The constructor method need 1 argument : your plugin class. This is for your actions in game by clicking on items.
The construction have to be written like this:
Init method
The init method is call only once : when your menu is instantiate. This mean all items you gonna add in your menu by this function cannot be updated. Or if you want to update it, you have to erease it in update.
This method have to be written like this:
Event methods
There are 2 event methods :
onOpenMenu
onCloseMenu
Each of them are used by super. So do not forget to call the super method.
Each of them get as argument the player who opened the menu. You can add in the run time items in your menu. But do not forget to set your menu non static (in constructor).
Let's add this menu
You have to go back in your main plugin class and follow the code:
Quick Start
Last updated