Class SpigotInventoryUI

java.lang.Object
io.github.projectunified.craftux.spigot.SpigotInventoryUI
All Implemented Interfaces:
org.bukkit.inventory.InventoryHolder

public class SpigotInventoryUI extends Object implements org.bukkit.inventory.InventoryHolder
The inventory UI for Spigot
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpigotInventoryUI(UUID viewerId, String title, int size)
    Create a new Chest inventory UI
    SpigotInventoryUI(UUID viewerId, String title, org.bukkit.event.inventory.InventoryType type)
    Create a new Chest inventory UI
    SpigotInventoryUI(UUID viewerId, Function<org.bukkit.inventory.InventoryHolder,org.bukkit.inventory.Inventory> inventoryFunction)
    Create a new inventory UI
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.inventory.Inventory
     
    Get the mask
    Get the viewer's UUID
    protected void
    onClick(org.bukkit.event.inventory.InventoryClickEvent event)
    Called when the inventory is clicked.
    protected void
    onClose(org.bukkit.event.inventory.InventoryCloseEvent event)
    Called when the inventory is closed.
    protected void
    onDrag(org.bukkit.event.inventory.InventoryDragEvent event)
    Called when the inventory is dragged.
    protected void
    onOpen(org.bukkit.event.inventory.InventoryOpenEvent event)
    Called when the inventory is opened.
    void
    Open the inventory for the viewer
    void
    open(org.bukkit.entity.Player player)
    Open the inventory for the player
    void
    setMask(Mask mask)
    Set the mask
    void
    setMoveItemOnBottom(boolean moveItemOnBottom)
    Whether to allow moving items in the bottom inventory (player inventory)
    void
    Update the inventory

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SpigotInventoryUI

      public SpigotInventoryUI(UUID viewerId, Function<org.bukkit.inventory.InventoryHolder,org.bukkit.inventory.Inventory> inventoryFunction)
      Create a new inventory UI
      Parameters:
      viewerId - the viewer's UUID
      inventoryFunction - the function to create the inventory
    • SpigotInventoryUI

      public SpigotInventoryUI(UUID viewerId, String title, int size)
      Create a new Chest inventory UI
      Parameters:
      viewerId - the viewer's UUID
      title - the title of the inventory
      size - the size of the inventory (must be a multiple of 9)
    • SpigotInventoryUI

      public SpigotInventoryUI(UUID viewerId, String title, org.bukkit.event.inventory.InventoryType type)
      Create a new Chest inventory UI
      Parameters:
      viewerId - the viewer's UUID
      title - the title of the inventory
      type - the type of the inventory
  • Method Details

    • getInventory

      public org.bukkit.inventory.Inventory getInventory()
      Specified by:
      getInventory in interface org.bukkit.inventory.InventoryHolder
    • open

      public void open(org.bukkit.entity.Player player)
      Open the inventory for the player
      Parameters:
      player - the player
    • open

      public void open()
      Open the inventory for the viewer
    • getViewerId

      public UUID getViewerId()
      Get the viewer's UUID
      Returns:
      the viewer's UUID
    • getMask

      public Mask getMask()
      Get the mask
      Returns:
      the mask
    • setMask

      public void setMask(Mask mask)
      Set the mask
      Parameters:
      mask - the mask
    • setMoveItemOnBottom

      public void setMoveItemOnBottom(boolean moveItemOnBottom)
      Whether to allow moving items in the bottom inventory (player inventory)
      Parameters:
      moveItemOnBottom - true to allow moving items in the bottom inventory
    • update

      public void update()
      Update the inventory
    • onOpen

      protected void onOpen(org.bukkit.event.inventory.InventoryOpenEvent event)
      Called when the inventory is opened. Override to add custom behavior.
      Parameters:
      event - the event
    • onClick

      protected void onClick(org.bukkit.event.inventory.InventoryClickEvent event)
      Called when the inventory is clicked. Override to add custom behavior.
      Parameters:
      event - the event
    • onClose

      protected void onClose(org.bukkit.event.inventory.InventoryCloseEvent event)
      Called when the inventory is closed. Override to add custom behavior.
      Parameters:
      event - the event
    • onDrag

      protected void onDrag(org.bukkit.event.inventory.InventoryDragEvent event)
      Called when the inventory is dragged. Override to add custom behavior.
      Parameters:
      event - the event