Package xyz.xenondevs.invui.gui
Interface Gui
- All Known Implementing Classes:
- AbstractGui,- AbstractPagedGui,- AbstractScrollGui,- AbstractTabGui
public interface Gui
A Gui is a container for width * height 
Each
A
In order to create an
SlotElements.Each
SlotElement can either be an Item,
 a reference to a Inventory's or another Gui's
 slot index.A
Gui is not an Inventory, nor does
 it access one. It just contains SlotElements and their positions.In order to create an
Inventory which is visible
 to players, you will need to use a Window.- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> AGuibuilder.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAddsItemsto the gui.voidaddSlotElements(@NotNull SlotElement... slotElements) AddsSlotElementsto theGui.voidapplyStructure(@NotNull Structure structure) voidCancels the runningAnimationif there is one.voidstatic @NotNull Guiempty(int width, int height) Creates a new emptyGui.voidvoidvoidfillBorders(@Nullable Item item, boolean replaceExisting) voidfillColumn(int column, @Nullable Item item, boolean replaceExisting) Fills one column with a specificItemvoidfillRectangle(int x, int y, int width, int height, @Nullable Item item, boolean replaceExisting) voidfillRectangle(int x, int y, int width, @NotNull Inventory inventory, boolean replaceExisting) voidfillRectangle(int x, int y, int width, @NotNull Inventory inventory, @Nullable ItemProvider background, boolean replaceExisting) voidfillRectangle(int x, int y, @NotNull Gui gui, boolean replaceExisting) voidFills one row with a specificItem@NotNull Set<@NotNull org.bukkit.entity.Player> Finds allPlayersthat are currently seeing thisWindow.@Nullable ItemProviderGets theItemProviderthat will be used if nothing else is placed on a slot.intGets the height of theGui@Nullable ItemgetItem(int index) Gets theItemplaced on that slot.@Nullable ItemgetItem(int x, int y) Gets theItemon these coordinates.intgetSize()Gets the size of theGui.@Nullable SlotElementgetSlotElement(int index) Gets theSlotElementplaced on that slot.@Nullable SlotElementgetSlotElement(int x, int y) Gets theSlotElementon these coordinates.@Nullable SlotElement @NotNull []Gets allSlotElementsof thisGuiin an Array.intgetWidth()Gets the width of theGuibooleanhasSlotElement(int index) Gets if there is aSlotElementplaced on that slot.booleanhasSlotElement(int x, int y) Gets if there is aSlotElementon these coordinates.booleanisFrozen()Gets if theGuiis frozen.booleanGets whether it is possible to shift-click items into and cursor collect items from allInventoryslots of partially obscured embeddedInventories.static Gui.Builder.Normalnormal()Creates a newGui Builderfor a normalGui.static @NotNull Guinormal(@NotNull Consumer<@NotNull Gui.Builder.Normal> consumer) static @NotNull GuiCreates a new emptyGui.voidplayAnimation(@NotNull Animation animation, @Nullable Predicate<@NotNull SlotElement> filter) Plays anAnimation.voidremove(int index) Remove theItemwhich are placed on these slots.voidremove(int x, int y) Removes anItemby its coordinates.voidsetBackground(@Nullable ItemProvider itemProvider) Sets theItemProviderthat will be used if nothing else is placed on a slot.voidsetFrozen(boolean frozen) Freezes or unfreezes theGui.voidsetIgnoreObscuredInventorySlots(boolean ignoreObscuredInventorySlots) Configures whether it is possible to shift-click items into and cursor collect items from allInventoryslots of partially obscured embeddedInventories.voidSets theItemon these coordinates.voidSets theItemon that slotvoidsetSlotElement(int x, int y, @Nullable SlotElement slotElement) Sets theSlotElementon these coordinates.voidsetSlotElement(int index, @Nullable SlotElement slotElement) Sets theSlotElementon these coordinates.
- 
Method Details- 
normalCreates a newGui Builderfor a normalGui.- Returns:
- The new Gui Builder.
 
- 
normal@NotNull static @NotNull Gui normal(@NotNull @NotNull Consumer<@NotNull Gui.Builder.Normal> consumer) - Parameters:
- consumer- The- Consumerto configure the- Gui Builder.
- Returns:
- The created Gui.
 
- 
emptyCreates a new emptyGui.
- 
ofCreates a new emptyGui.
- 
getSizeint getSize()Gets the size of theGui.- Returns:
- The size of the gui.
 
- 
getWidthint getWidth()Gets the width of theGui- Returns:
- The width of the Gui
 
- 
getHeightint getHeight()Gets the height of theGui- Returns:
- The height of the Gui
 
- 
setSlotElementSets theSlotElementon these coordinates. If you need to set anItem, please usesetItem(int, int, Item)instead.- Parameters:
- x- The x coordinate
- y- The y coordinate
- slotElement- The- SlotElementto be placed there.
 
- 
setSlotElementSets theSlotElementon these coordinates. If you need to set anItem, please usesetItem(int, Item)instead.- Parameters:
- index- The slot index
- slotElement- The- SlotElementto be placed there.
 
- 
addSlotElementsAddsSlotElementsto theGui.- Parameters:
- slotElements- The- SlotElementsto add.
 
- 
getSlotElementGets theSlotElementon these coordinates.- Parameters:
- x- The x coordinate
- y- The y coordinate
- Returns:
- The SlotElementplaced there
 
- 
getSlotElementGets theSlotElementplaced on that slot.- Parameters:
- index- The slot index
- Returns:
- The SlotElementplaced on that slot
 
- 
hasSlotElementboolean hasSlotElement(int x, int y) Gets if there is aSlotElementon these coordinates.- Parameters:
- x- The x coordinate
- y- The y coordinate
- Returns:
- If there is a SlotElementplaced there
 
- 
hasSlotElementboolean hasSlotElement(int index) Gets if there is aSlotElementplaced on that slot.- Parameters:
- index- The slot index
- Returns:
- If there is a SlotElementplaced there
 
- 
getSlotElementsGets allSlotElementsof thisGuiin an Array.- Returns:
- All SlotElementsof thisGui
 
- 
setItemSets theItemon these coordinates.
- 
setItemSets theItemon that slot
- 
addItemsAddsItemsto the gui.- Parameters:
- items- The- Itemsthat should be added to the gui
 
- 
getItemGets theItemon these coordinates.- Parameters:
- x- The x coordinate
- y- The y coordinate
- Returns:
- The Itemwhich is placed on that slot or null if there isn't one
 
- 
getItemGets theItemplaced on that slot.- Parameters:
- index- The slot index
- Returns:
- The Itemwhich is placed on that slot or null if there isn't one
 
- 
getBackgroundGets theItemProviderthat will be used if nothing else is placed on a slot.- Returns:
- The ItemProvider
 
- 
setBackgroundSets theItemProviderthat will be used if nothing else is placed on a slot.- Parameters:
- itemProvider- The- ItemProvider
 
- 
removevoid remove(int x, int y) Removes anItemby its coordinates.- Parameters:
- x- The x coordinate
- y- The y coordinate
 
- 
removevoid remove(int index) Remove theItemwhich are placed on these slots.- Parameters:
- index- The slot index of the- Itemsthat should be removed
 
- 
applyStructure- Parameters:
- structure- The structure
 
- 
findAllWindows
- 
findAllCurrentViewersFinds allPlayersthat are currently seeing thisWindow.- Returns:
- The list of Playersthat are currently seeing thisWindow
 
- 
closeForAllViewersvoid closeForAllViewers()Closes the openInventoryfor all viewers ofWindowswhere thisGuiis displayed.If the Windowsare not marked as "retain", they will be removed from theWindowManagerautomatically.
- 
playAnimationvoid playAnimation(@NotNull @NotNull Animation animation, @Nullable @Nullable Predicate<@NotNull SlotElement> filter) Plays anAnimation.- Parameters:
- animation- The- Animationto play.
- filter- The filter that selects which- SlotElementsshould be animated.
 
- 
cancelAnimationvoid cancelAnimation()Cancels the runningAnimationif there is one.
- 
setFrozenvoid setFrozen(boolean frozen) - Parameters:
- frozen- If the- Guishould be frozen or not.
 
- 
isFrozenboolean isFrozen()Gets if theGuiis frozen.- Returns:
- If the Guiis frozen.
 
- 
setIgnoreObscuredInventorySlotsvoid setIgnoreObscuredInventorySlots(boolean ignoreObscuredInventorySlots) Configures whether it is possible to shift-click items into and cursor collect items from allInventoryslots of partially obscured embeddedInventories.Defaults to true. - Parameters:
- ignoreObscuredInventorySlots- Whether obscured- Inventoryslots should be ignored when shift-clicking and collecting to the cursor.
 
- 
isIgnoreObscuredInventorySlotsboolean isIgnoreObscuredInventorySlots()Gets whether it is possible to shift-click items into and cursor collect items from allInventoryslots of partially obscured embeddedInventories.- Returns:
- Whether obscured Inventoryslots are ignored when shift-clicking and collecting to the cursor.
 
- 
fill
- 
fill
- 
fillRowFills one row with a specificItem
- 
fillColumnFills one column with a specificItem
- 
fillBorders
- 
fillRectanglevoid fillRectangle(int x, int y, int width, int height, @Nullable @Nullable Item item, boolean replaceExisting) - Parameters:
- x- The x coordinate where the rectangle should start.
- y- The y coordinate where the rectangle should start.
- width- The width of the rectangle.
- height- The height of the rectangle
- item- The- Itemthat should be used or null to remove an existing item.
- replaceExisting- If existing- Itemsshould be replaced.
 
- 
fillRectangle- Parameters:
- x- The x coordinate where the rectangle should start
- y- The y coordinate where the rectangle should start
- gui- The- Guito be put into this- Gui
- replaceExisting- If existing- SlotElementsshould be replaced.
 
- 
fillRectanglevoid fillRectangle(int x, int y, int width, @NotNull @NotNull Inventory inventory, boolean replaceExisting) - Parameters:
- x- The x coordinate where the rectangle should start
- y- The y coordinate where the rectangle should start
- width- The line length of the rectangle.
- inventory- The- Inventoryto be put into this- Gui.
- replaceExisting- If existing- SlotElementsshould be replaced.
 
- 
fillRectanglevoid fillRectangle(int x, int y, int width, @NotNull @NotNull Inventory inventory, @Nullable @Nullable ItemProvider background, boolean replaceExisting) - Parameters:
- x- The x coordinate where the rectangle should start
- y- The y coordinate where the rectangle should start
- width- The line length of the rectangle.
- inventory- The- Inventoryto be put into this- Gui.
- background- The- ItemProviderfor empty slots of the- Inventory
- replaceExisting- If existing- SlotElementsshould be replaced.
 
 
-