Package de.studiocode.invui.window
Interface Window
- All Superinterfaces:
GUIParent
- All Known Implementing Classes:
AnvilSplitWindow,AnvilWindow,BaseWindow,CartographySplitWindow,CartographyWindow,CombinedWindow,MergedWindow,SimpleCombinedWindow,SimpleSplitWindow,SimpleWindow,SingleWindow,SplitWindow
A window is the way to show a player a GUI.
Windows can only have one viewer.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCloseHandler(Runnable closeHandler) Adds a close handler that will be called when this window gets closed.voidchangeTitle(@NotNull String title) Changes the title of theInventory.voidchangeTitle(@NotNull net.md_5.bungee.api.chat.BaseComponent[] title) Changes the title of theInventory.voidclose(boolean closeForViewer) Removes theWindowfrom theWindowManagerlist.voidCloses the underlyingInventoryfor its viewer.org.bukkit.entity.PlayerGets the currentPlayerthat is viewing thisWindowor null of there isn't one.GUI[]getGuis()Gets the underlyingGUIs.org.bukkit.inventory.Inventory[]Gets the underlyingInventorys.org.bukkit.entity.PlayerGets the viewer of thisWindowGets the viewer'sUUIDvoidhandleClick(org.bukkit.event.inventory.InventoryClickEvent event) voidhandleClose(org.bukkit.entity.Player player) A method called by theWindowManagerto notify theWindowthat its underlyingInventoryis being closed.voidhandleCursorCollect(org.bukkit.event.inventory.InventoryClickEvent event) A method called by theWindowManagerto notify theWindowthat aPlayeris trying to collectItemStackto the cursor by double-clicking in the player inventory.voidhandleDrag(org.bukkit.event.inventory.InventoryDragEvent event) A method called by theWindowManagerto notify theWindowthatItemStacks have been dragged inside it.voidhandleItemProviderUpdate(Item item) A method called by theItemitself to notify theWindowthat itsItemProviderhas been updated and theItemStackin theInventoryshould be replaced.voidhandleItemShift(org.bukkit.event.inventory.InventoryClickEvent event) A method called by theWindowManagerto notify theWindowthatItemStacks have been shift-clicked from the lowerInventoryto thisWindowvoidhandleOpen(org.bukkit.event.inventory.InventoryOpenEvent event) A method called by theWindowManagerto notify theWindowthat its underlyingInventoryis being opened.voidhandleViewerDeath(org.bukkit.event.entity.PlayerDeathEvent event) A method called by theWindowManagerto notify theWindowthat it's viewer has died.voidhandleVirtualInventoryUpdate(VirtualInventory virtualInventory) A method called by theVirtualInventoryto notify theWindowthat one if it's contents has been updated and theItemStack's displayed in theInventoryshould be replaced.booleanGets if the player is able to close theInventory.booleanisClosed()Gets if theWindowis closed and can't be shown again.voidremoveCloseHandler(Runnable closeHandler) Removes a close handler that has been added previously.voidsetCloseable(boolean closeable) Sets if the player should be able to close theInventory.voidshow()Shows the window to the player.Methods inherited from interface de.studiocode.invui.gui.GUIParent
handleSlotElementUpdate
-
Method Details
-
getInventories
org.bukkit.inventory.Inventory[] getInventories()Gets the underlyingInventorys.- Returns:
- The underlying
Inventorys.
-
getGuis
GUI[] getGuis()Gets the underlyingGUIs.- Returns:
- The underlying
GUIs.
-
handleClick
void handleClick(org.bukkit.event.inventory.InventoryClickEvent event) - Parameters:
event- TheInventoryClickEventassociated with this action.
-
handleDrag
void handleDrag(org.bukkit.event.inventory.InventoryDragEvent event) A method called by theWindowManagerto notify theWindowthatItemStacks have been dragged inside it.- Parameters:
event- TheInventoryDragEventassociated with this action.
-
handleItemShift
void handleItemShift(org.bukkit.event.inventory.InventoryClickEvent event) A method called by theWindowManagerto notify theWindowthatItemStacks have been shift-clicked from the lowerInventoryto thisWindow- Parameters:
event- TheInventoryClickEventassociated with this action.
-
handleCursorCollect
void handleCursorCollect(org.bukkit.event.inventory.InventoryClickEvent event) A method called by theWindowManagerto notify theWindowthat aPlayeris trying to collectItemStackto the cursor by double-clicking in the player inventory. This method is not called when the player inventory is also part of theWindow. (MergedWindow)- Parameters:
event- TheInventoryClickEventassociated with this action.
-
handleOpen
void handleOpen(org.bukkit.event.inventory.InventoryOpenEvent event) A method called by theWindowManagerto notify theWindowthat its underlyingInventoryis being opened.- Parameters:
event- TheInventoryOpenEventassociated with this action.
-
handleClose
void handleClose(org.bukkit.entity.Player player) A method called by theWindowManagerto notify theWindowthat its underlyingInventoryis being closed.- Parameters:
player- ThePlayerwho closed this inventory.
-
handleViewerDeath
void handleViewerDeath(org.bukkit.event.entity.PlayerDeathEvent event) A method called by theWindowManagerto notify theWindowthat it's viewer has died.- Parameters:
event- ThePlayerDeathEventassociated with this action.
-
handleItemProviderUpdate
A method called by theItemitself to notify theWindowthat itsItemProviderhas been updated and theItemStackin theInventoryshould be replaced.- Parameters:
item- TheItemwhoseItemProviderhas been updated.
-
handleVirtualInventoryUpdate
A method called by theVirtualInventoryto notify theWindowthat one if it's contents has been updated and theItemStack's displayed in theInventoryshould be replaced.- Parameters:
virtualInventory- TheVirtualInventory
-
addCloseHandler
Adds a close handler that will be called when this window gets closed.- Parameters:
closeHandler- The close handler to add
-
removeCloseHandler
Removes a close handler that has been added previously.- Parameters:
closeHandler- The close handler to remove
-
close
void close(boolean closeForViewer) Removes theWindowfrom theWindowManagerlist. If this method is called, theWindowcan't be shown again.- Parameters:
closeForViewer- If the underlyingInventoryshould be closed for the viewer.
-
isClosed
boolean isClosed()Gets if theWindowis closed and can't be shown again.- Returns:
- If the
Windowis closed.
-
closeForViewer
void closeForViewer()Closes the underlyingInventoryfor its viewer. -
show
void show()Shows the window to the player. -
isCloseable
boolean isCloseable()Gets if the player is able to close theInventory.- Returns:
- If the player is able to close the
Inventory.
-
setCloseable
void setCloseable(boolean closeable) Sets if the player should be able to close theInventory.- Parameters:
closeable- If the player should be able to close theInventory.
-
changeTitle
void changeTitle(@NotNull @NotNull net.md_5.bungee.api.chat.BaseComponent[] title) Changes the title of theInventory.- Parameters:
title- The new title
-
changeTitle
Changes the title of theInventory.- Parameters:
title- The new title
-
getViewer
org.bukkit.entity.Player getViewer()Gets the viewer of thisWindow- Returns:
- The viewer of this window.
-
getCurrentViewer
org.bukkit.entity.Player getCurrentViewer()Gets the currentPlayerthat is viewing thisWindowor null of there isn't one.- Returns:
- The current viewer of this
Window(can be null)
-
getViewerUUID
UUID getViewerUUID()Gets the viewer'sUUID- Returns:
- The viewer's
UUID
-