Class CustomGui

java.lang.Object
dev.piglin.piglinworldapi.gui.CustomGui
Direct Known Subclasses:
ListGui

public abstract class CustomGui extends Object
Extend this class to make a custom gui.
  • Constructor Details

    • CustomGui

      public CustomGui(List<Integer> allowedSlots)
      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