Class SpigotInventoryUI
java.lang.Object
io.github.projectunified.craftux.spigot.SpigotInventoryUI
- All Implemented Interfaces:
org.bukkit.inventory.InventoryHolder
The inventory UI for Spigot
-
Constructor Summary
ConstructorsConstructorDescriptionSpigotInventoryUI
(UUID viewerId, String title, int size) Create a new Chest inventory UISpigotInventoryUI
(UUID viewerId, String title, org.bukkit.event.inventory.InventoryType type) Create a new Chest inventory UISpigotInventoryUI
(UUID viewerId, Function<org.bukkit.inventory.InventoryHolder, org.bukkit.inventory.Inventory> inventoryFunction) Create a new inventory UI -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.Inventory
getMask()
Get the maskGet the viewer's UUIDprotected 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()
Open the inventory for the viewervoid
open
(org.bukkit.entity.Player player) Open the inventory for the playervoid
Set the maskvoid
setMoveItemOnBottom
(boolean moveItemOnBottom) Whether to allow moving items in the bottom inventory (player inventory)void
update()
Update the inventory
-
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 UUIDinventoryFunction
- the function to create the inventory
-
SpigotInventoryUI
Create a new Chest inventory UI- Parameters:
viewerId
- the viewer's UUIDtitle
- the title of the inventorysize
- 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 UUIDtitle
- the title of the inventorytype
- the type of the inventory
-
-
Method Details
-
getInventory
public org.bukkit.inventory.Inventory getInventory()- Specified by:
getInventory
in interfaceorg.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
Get the viewer's UUID- Returns:
- the viewer's UUID
-
getMask
Get the mask- Returns:
- the mask
-
setMask
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
-