Package dev.piglin.piglinworldapi.gui
Class CustomGui
java.lang.Object
dev.piglin.piglinworldapi.gui.CustomGui
- Direct Known Subclasses:
ListGui
Extend this class to make a custom gui.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic classCloses the current gui and opens the new gui.static classDo nothing -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidonClose(org.bukkit.event.inventory.InventoryCloseEvent event)Handle inventory closeabstract CustomGui.ClickResultonItemClick(org.bukkit.event.inventory.InventoryClickEvent event)Handle clicksabstract CustomGui.ClickResultonItemClickInInventory(org.bukkit.event.inventory.InventoryClickEvent event)Handle clicks in player's inventory but when your inventory is openabstract voidonItemDrag(org.bukkit.event.inventory.InventoryDragEvent event)Handle item dragabstract org.bukkit.inventory.Inventoryopen(org.bukkit.entity.Player player)Create an inventory and open it.
-
Constructor Details
-
CustomGui
- Parameters:
allowedSlots- See $allowedSlots
-
-
Method Details
-
onItemClick
public abstract CustomGui.ClickResult onItemClick(org.bukkit.event.inventory.InventoryClickEvent event)Handle clicks- Parameters:
event- The event- Returns:
- Result of this interaction
-
onItemClickInInventory
public abstract CustomGui.ClickResult onItemClickInInventory(org.bukkit.event.inventory.InventoryClickEvent event)Handle clicks in player's inventory but when your inventory is open- Parameters:
event- The event- Returns:
- Result of this interaction
-
onItemDrag
public abstract void onItemDrag(org.bukkit.event.inventory.InventoryDragEvent event)Handle item drag- Parameters:
event- The event
-
onClose
public abstract void onClose(org.bukkit.event.inventory.InventoryCloseEvent event)Handle inventory close- Parameters:
event- The event
-
open
public abstract org.bukkit.inventory.Inventory open(org.bukkit.entity.Player player)Create an inventory and open it. Usually this method's implementation looks like this:var inventory = Bukkit.createInventory(null, inventorySize, "Name"); // Some Inventory#setItem calls // Maybe GuiUtils.fillWithBarriers(plugin, inventory); player.openInventory(inventory); return inventory;- Parameters:
player- The player- Returns:
- The inventory
-