Package xyz.xenondevs.invui.window
Class AbstractSingleWindow
java.lang.Object
xyz.xenondevs.invui.window.AbstractWindow
xyz.xenondevs.invui.window.AbstractSingleWindow
A
Window that just uses the top Inventory.
Only in very rare circumstances should this class be used directly.
Instead, use the static builder functions in the
Window interfaces to create a new Window, such as
Window.single().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAbstractSingleWindow.AbstractBuilder<W extends Window,S extends Window.Builder.Single<W, S>> Builder for aAbstractSingleWindow.Nested classes/interfaces inherited from interface xyz.xenondevs.invui.window.Window
Window.Builder<W extends Window,S extends Window.Builder<W, S>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.bukkit.inventory.InventoryTheInventoryof the window. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSingleWindow(org.bukkit.entity.Player viewer, xyz.xenondevs.inventoryaccess.component.ComponentWrapper title, AbstractGui gui, org.bukkit.inventory.Inventory inventory, boolean closeable) Creates a newAbstractSingleWindow. -
Method Summary
Modifier and TypeMethodDescriptionGets the contentinventoriesassociated with thisWindow.getGui()Gets theGuiused for thisAbstractSingleWindow.protected Pair<AbstractGui, Integer> getGuiAt(int index) Gets theAbstractGuiat the given index.getGuis()org.bukkit.inventory.Inventory[]Gets theinventoriesassociated with thisWindow.@Nullable org.bukkit.inventory.ItemStack @Nullable []Gets the contents of theviewer'sinventory.protected SlotElementgetSlotElement(int index) Gets theSlotElementat the given index.voidhandleClick(org.bukkit.event.inventory.InventoryClickEvent event) Handles a click in theWindow.protected voidHandles the closing of theWindow.voidhandleItemShift(org.bukkit.event.inventory.InventoryClickEvent event) Handles an item-shift action in theWindow.protected voidHandles the opening of theWindow.voidhandleSlotElementUpdate(Gui child, int slotIndex) Called by the childGuito report an update of aSlotElement.voidhandleViewerDeath(org.bukkit.event.entity.PlayerDeathEvent event) Handles the death of the viewer of theWindow.protected voidInitializes the items in theWindow.protected voidsetInvItem(int slot, org.bukkit.inventory.ItemStack itemStack) Puts the givenItemStackinto the inventory at the given slot.Methods inherited from class xyz.xenondevs.invui.window.AbstractWindow
addCloseHandler, addOpenHandler, addOutsideClickHandler, changeTitle, changeTitle, changeTitle, close, getCurrentViewer, getInvSlotElements, getItemSlotElements, getLang, getViewer, getViewerUUID, handleClickEvent, handleCloseEvent, handleCursorCollect, handleDragEvent, handleInventoryUpdate, handleItemProviderUpdate, handleOpenEvent, isCloseable, isOpen, open, openInventory, redrawItem, redrawItem, removeCloseHandler, removeOutsideClickHandler, setCloseable, setCloseHandlers, setOpenHandlers, setOutsideClickHandlers
-
Field Details
-
inventory
protected org.bukkit.inventory.Inventory inventoryTheInventoryof the window.
-
-
Constructor Details
-
AbstractSingleWindow
public AbstractSingleWindow(org.bukkit.entity.Player viewer, xyz.xenondevs.inventoryaccess.component.ComponentWrapper title, AbstractGui gui, org.bukkit.inventory.Inventory inventory, boolean closeable) Creates a newAbstractSingleWindow.- Parameters:
viewer- The player that views the window.title- The title of the window.gui- The gui of the window.inventory- The inventory of the window.closeable- Whether the window is closeable.
-
-
Method Details
-
initItems
protected void initItems()Description copied from class:AbstractWindowInitializes the items in theWindow.- Specified by:
initItemsin classAbstractWindow
-
setInvItem
protected void setInvItem(int slot, org.bukkit.inventory.ItemStack itemStack) Description copied from class:AbstractWindowPuts the givenItemStackinto the inventory at the given slot.- Specified by:
setInvItemin classAbstractWindow- Parameters:
slot- The slot to put the item into.itemStack- The item to put into the inventory.
-
handleOpened
protected void handleOpened()Description copied from class:AbstractWindowHandles the opening of theWindow.- Specified by:
handleOpenedin classAbstractWindow
-
handleClosed
protected void handleClosed()Description copied from class:AbstractWindowHandles the closing of theWindow.- Specified by:
handleClosedin classAbstractWindow
-
handleSlotElementUpdate
Description copied from interface:GuiParentCalled by the childGuito report an update of aSlotElement.- Parameters:
child- The childGuiwhoseSlotElementhas changedslotIndex- The slot index of the changedSlotElementin the childGui
-
handleClick
public void handleClick(org.bukkit.event.inventory.InventoryClickEvent event) Description copied from class:AbstractWindowHandles a click in theWindow.- Specified by:
handleClickin classAbstractWindow- Parameters:
event- TheInventoryClickEventthat occurred.
-
handleItemShift
public void handleItemShift(org.bukkit.event.inventory.InventoryClickEvent event) Description copied from class:AbstractWindowHandles an item-shift action in theWindow.- Specified by:
handleItemShiftin classAbstractWindow- Parameters:
event- TheInventoryClickEventthat occurred.
-
getContentInventories
Description copied from class:AbstractWindowGets the contentinventoriesassociated with thisWindow. These are not UI inventories, but actual inventories contained inside theGui, such asVirtualInventory- Specified by:
getContentInventoriesin classAbstractWindow- Returns:
- The content inventories associated with this window.
-
getGuiAt
Description copied from class:AbstractWindowGets theAbstractGuiat the given index.- Specified by:
getGuiAtin classAbstractWindow- Parameters:
index- The index of the slot.- Returns:
- The
AbstractGuiit's slot at that slot.
-
getSlotElement
Description copied from class:AbstractWindowGets theSlotElementat the given index.- Specified by:
getSlotElementin classAbstractWindow- Parameters:
index- The index of the slot.- Returns:
- The
SlotElementat the given index.
-
handleViewerDeath
public void handleViewerDeath(org.bukkit.event.entity.PlayerDeathEvent event) Description copied from class:AbstractWindowHandles the death of the viewer of theWindow.- Specified by:
handleViewerDeathin classAbstractWindow- Parameters:
event- ThePlayerDeathEventthat occurred.
-
getInventories
public org.bukkit.inventory.Inventory[] getInventories()Description copied from class:AbstractWindowGets theinventoriesassociated with thisWindow.- Specified by:
getInventoriesin classAbstractWindow- Returns:
- The inventories associated with this window.
-
getGuis
Description copied from class:AbstractWindow- Specified by:
getGuisin classAbstractWindow- Returns:
- The guis displayed with this window.
-
getGui
Gets theGuiused for thisAbstractSingleWindow.- Returns:
- The
Guiused for thisAbstractSingleWindow.
-
getPlayerItems
@Nullable public @Nullable org.bukkit.inventory.ItemStack @Nullable [] getPlayerItems()Description copied from interface:WindowGets the contents of theviewer'sinventory. This method will always return the actual inventory contents and will not be affected by double windows placing gui items in thePlayer'sinventory.- Returns:
- The contents of the
viewer'sinventory, or null if theWindowisn't open.
-