Package de.studiocode.invui.window.impl
Class BaseWindow
java.lang.Object
de.studiocode.invui.window.impl.BaseWindow
- Direct Known Subclasses:
MergedWindow,SingleWindow
-
Constructor Summary
ConstructorsConstructorDescriptionBaseWindow(UUID viewerUUID, net.md_5.bungee.api.chat.BaseComponent[] title, int size, boolean closeable, boolean removeOnClose) -
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.getGuiAt(int index) protected Map<Integer,SlotElement> getItemSlotElements(Item item) protected abstract SlotElementgetSlotElement(int index) org.bukkit.entity.PlayerGets the viewer of thisWindowGets the viewer'sUUIDprotected Map<Integer,SlotElement> getVISlotElements(VirtualInventory virtualInventory) voidhandleClose(org.bukkit.entity.Player player) A method called by theWindowManagerto notify theWindowthat its underlyingInventoryis being closed.protected abstract voidvoidhandleDrag(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.voidhandleOpen(org.bukkit.event.inventory.InventoryOpenEvent event) A method called by theWindowManagerto notify theWindowthat its underlyingInventoryis being opened.protected abstract voidvoidhandleVirtualInventoryUpdate(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.protected voidredrawItem(int index) protected voidredrawItem(int index, SlotElement element, boolean setItem) protected voidregister()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.protected abstract voidsetInvItem(int slot, org.bukkit.inventory.ItemStack itemStack) voidshow()Shows the window to the player.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.studiocode.invui.gui.GUIParent
handleSlotElementUpdateMethods inherited from interface de.studiocode.invui.window.Window
getGuis, getInventories, handleClick, handleCursorCollect, handleItemShift, handleViewerDeath
-
Constructor Details
-
BaseWindow
public BaseWindow(UUID viewerUUID, net.md_5.bungee.api.chat.BaseComponent[] title, int size, boolean closeable, boolean removeOnClose)
-
-
Method Details
-
register
protected void register() -
redrawItem
protected void redrawItem(int index) -
redrawItem
-
handleDrag
public void handleDrag(org.bukkit.event.inventory.InventoryDragEvent event) Description copied from interface:WindowA method called by theWindowManagerto notify theWindowthatItemStacks have been dragged inside it.- Specified by:
handleDragin interfaceWindow- Parameters:
event- TheInventoryDragEventassociated with this action.
-
handleOpen
public void handleOpen(org.bukkit.event.inventory.InventoryOpenEvent event) Description copied from interface:WindowA method called by theWindowManagerto notify theWindowthat its underlyingInventoryis being opened.- Specified by:
handleOpenin interfaceWindow- Parameters:
event- TheInventoryOpenEventassociated with this action.
-
handleClose
public void handleClose(org.bukkit.entity.Player player) Description copied from interface:WindowA method called by theWindowManagerto notify theWindowthat its underlyingInventoryis being closed.- Specified by:
handleClosein interfaceWindow- Parameters:
player- ThePlayerwho closed this inventory.
-
handleItemProviderUpdate
Description copied from interface:WindowA method called by theItemitself to notify theWindowthat itsItemProviderhas been updated and theItemStackin theInventoryshould be replaced.- Specified by:
handleItemProviderUpdatein interfaceWindow- Parameters:
item- TheItemwhoseItemProviderhas been updated.
-
handleVirtualInventoryUpdate
Description copied from interface:WindowA method called by theVirtualInventoryto notify theWindowthat one if it's contents has been updated and theItemStack's displayed in theInventoryshould be replaced.- Specified by:
handleVirtualInventoryUpdatein interfaceWindow- Parameters:
virtualInventory- TheVirtualInventory
-
getItemSlotElements
-
getVISlotElements
-
close
public void close(boolean closeForViewer) Description copied from interface:WindowRemoves theWindowfrom theWindowManagerlist. If this method is called, theWindowcan't be shown again. -
closeForViewer
public void closeForViewer()Description copied from interface:WindowCloses the underlyingInventoryfor its viewer.- Specified by:
closeForViewerin interfaceWindow
-
show
public void show()Description copied from interface:WindowShows the window to the player. -
changeTitle
public void changeTitle(@NotNull @NotNull net.md_5.bungee.api.chat.BaseComponent[] title) Description copied from interface:WindowChanges the title of theInventory.- Specified by:
changeTitlein interfaceWindow- Parameters:
title- The new title
-
changeTitle
Description copied from interface:WindowChanges the title of theInventory.- Specified by:
changeTitlein interfaceWindow- Parameters:
title- The new title
-
addCloseHandler
Description copied from interface:WindowAdds a close handler that will be called when this window gets closed.- Specified by:
addCloseHandlerin interfaceWindow- Parameters:
closeHandler- The close handler to add
-
removeCloseHandler
Description copied from interface:WindowRemoves a close handler that has been added previously.- Specified by:
removeCloseHandlerin interfaceWindow- Parameters:
closeHandler- The close handler to remove
-
getCurrentViewer
public org.bukkit.entity.Player getCurrentViewer()Description copied from interface:WindowGets the currentPlayerthat is viewing thisWindowor null of there isn't one.- Specified by:
getCurrentViewerin interfaceWindow- Returns:
- The current viewer of this
Window(can be null)
-
getViewer
public org.bukkit.entity.Player getViewer()Description copied from interface:WindowGets the viewer of thisWindow -
getViewerUUID
Description copied from interface:WindowGets the viewer'sUUID- Specified by:
getViewerUUIDin interfaceWindow- Returns:
- The viewer's
UUID
-
isCloseable
public boolean isCloseable()Description copied from interface:WindowGets if the player is able to close theInventory.- Specified by:
isCloseablein interfaceWindow- Returns:
- If the player is able to close the
Inventory.
-
setCloseable
public void setCloseable(boolean closeable) Description copied from interface:WindowSets if the player should be able to close theInventory.- Specified by:
setCloseablein interfaceWindow- Parameters:
closeable- If the player should be able to close theInventory.
-
isClosed
public boolean isClosed()Description copied from interface:WindowGets if theWindowis closed and can't be shown again. -
setInvItem
protected abstract void setInvItem(int slot, org.bukkit.inventory.ItemStack itemStack) -
getSlotElement
-
getGuiAt
-
handleOpened
protected abstract void handleOpened() -
handleClosed
protected abstract void handleClosed()
-