GUI
The main implementation of the lib.
Creating a GUI
To create a GUI all you need to do is:
If rows are used instead of the type, it'll use GuiType.CHEST
.
Current supported GUI types:
CHEST - Default - 0 to 53 slots
WORKBENCH - 0 to 9 slots
HOPPER - 0 to 4 slots
DISPENSER - 0 to 8 slots
BREWING - 0 to 4 slots
Creating a GUI item
Each item added to the GUI need to be a GuiItem
.
Each GUI item needs an item stack, you may want to add a click action or not.
The action for an item is simply the InventoryClickEvent
so handle it like you would be doing your own listener.
Adding the item to the GUI
Now that we have our GuiItem
, we can easily add it to the GUI.
You have the option to set it the way you want, for example the slot 0
is the row 1, col 1
. Attention as if you specify a slot that exceeds the GUI limit it'll throw a GuiException
.
Opening the GUI
To open the GUI to the player you just need to call the method open
.
Last updated