Welcome to the ZGUIApi Spigot library page.
If you find bugs- report them as a GitHub issue. Thanks!
ZGUIApi is an Api to make Guis in Minecraft. You can use it with the versions starting from 1.8 to 1.19
Before using ZGUIApi you need to download the ZGUIApi plugin and put it in your plugins folder.
You need to also add it as a dependency in your plugin.yml file like this:
depend: [ZGUIApi]To use the API you will need to add it in your plugin
To Use it with maven you need to add the repo like this:
<repository>
<id>zffu-repo</id>
<url>https://nexus.zffu.ml/maven</url>
</repository>and add the dependency:
<dependency>
<groupId>net.zffu</groupId>
<artifactId>zgui-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>To use ZGUIAPI you will need to create a class that extends the class ZGui, you will need to return the GUI name and the amount of rows but you will be able to change that later
public class TestGUI extends ZGui {
public TestGUI() {
super("My Test GUI", 6);
}
}The maximum amount of rows is 6
To add an item you need to add a function in your constructor:
this.setItem(itemStack, 0);If you need to add the same item in multiple slots then you can use this function
this.setItemInSlots(itemStack, slotList);If you want to add a border to your gui you can use this function to do it:
this.fillBorder(itemStack);NOTE: This function only works if the amount of rows is atleast 3
If you want to fill the gui with one single item you can use
this.fillWithItem(itemStack);NOTE: This function will only fill up the slots that are empty
There are currently 4 events that you can use:
- When the gui is opened
- When the gui is closed
- When the player clicks on an item
- When the player drags out an item
An Event looks like this:
@Override
public boolean onItemDrag(Player p, ItemStack itemStack) {
return true;
}NOTE: You can cancel the event by returning true in the event function
| Event | Function | Cancelable |
|---|---|---|
| When the Gui opens | public boolean onGUIOpen(Player p) |
YES |
| When the Gui closes | public void onGUIClose(Player p) |
NO |
| When the player clicks on an item | public boolean onItemClick(Player p, ItemStack itemStack) |
YES |
| When the player drags out an item | public boolean onItemDrag(Player p, ItemStack itemStack) |
YES |