Package xyz.xenondevs.invui.gui
Class AbstractGui.AbstractBuilder<G extends Gui,S extends Gui.Builder<G,S>>
java.lang.Object
xyz.xenondevs.invui.gui.AbstractGui.AbstractBuilder<G,S>
- Type Parameters:
G
- The type ofAbstractGui
this builder buildsS
- The type of the builder itself
- All Implemented Interfaces:
Cloneable
,Gui.Builder<G,
S>
- Direct Known Subclasses:
AbstractPagedGui.AbstractBuilder
,AbstractScrollGui.AbstractBuilder
,AbstractTabGui.AbstractBuilder
- Enclosing class:
AbstractGui
public abstract static class AbstractGui.AbstractBuilder<G extends Gui,S extends Gui.Builder<G,S>>
extends Object
implements Gui.Builder<G,S>
A builder for
AbstractGuis
.
This class should only be used directly if you're creating a custom AbstractGui.AbstractBuilder
for a custom
AbstractGui
implementation. Otherwise, use the static builder functions in the Gui
interfaces,
such as Gui.normal()
to obtain a builder.
-
Nested Class Summary
Nested classes/interfaces inherited from interface xyz.xenondevs.invui.gui.Gui.Builder
Gui.Builder.Normal
-
Field Summary
Modifier and TypeFieldDescriptionprotected ItemProvider
The backgroundItemProvider
of theAbstractGui
being built.protected boolean
TheAbstractGui.frozen
state of theAbstractGui
being built.protected boolean
TheAbstractGui.ignoreObscuredInventorySlots
state of theAbstractGui
being built.A list ofConsumers
that will be run after theAbstractGui
has been built.protected Structure
The structure of theAbstractGui
being built. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddIngredient
(char key, @NotNull Supplier<? extends Item> itemSupplier) addIngredient
(char key, @NotNull org.bukkit.inventory.ItemStack itemStack) Adds anItemStack
ingredient under the given key.addIngredient
(char key, @NotNull SlotElement element) Adds aSlotElement
ingredient under the given key.addIngredient
(char key, @NotNull Marker marker) Adds aMarker
ingredient under the given key.addIngredient
(char key, @NotNull Inventory inventory) Adds anInventory
ingredient under the given key.addIngredient
(char key, @NotNull Inventory inventory, @Nullable ItemProvider background) Adds anInventory
ingredient under the given key.addIngredient
(char key, @NotNull Item item) Adds anItem
ingredient under the given key.addIngredient
(char key, @NotNull ItemProvider itemProvider) Adds anItemProvider
ingredient under the given key.addIngredientElementSupplier
(char key, @NotNull Supplier<? extends SlotElement> elementSupplier) Adds aSupplier
ofSlotElements
ingredient under the given key.addModifier
(@NotNull Consumer<@NotNull G> modifier) Sets the background of theGui
.protected void
applyModifiers
(G gui) Applies themodifiers
to the givenAbstractGui
.clone()
Clones the Gui Builder.setBackground
(@NotNull org.bukkit.inventory.ItemStack itemStack) Sets the background of theGui
.setBackground
(@NotNull ItemProvider itemProvider) Sets the background of theGui
.setFrozen
(boolean frozen) Sets whether theGui
should be frozen.setIgnoreObscuredInventorySlots
(boolean ignoreObscuredInventorySlots) Sets whether it is possible to shift-click items into and cursor collect items from allInventory
slots of partially obscured embeddedInventories
.setModifiers
(@NotNull List<@NotNull Consumer<@NotNull G>> modifiers) Sets the background of theGui
.setStructure
(int width, int height, @NotNull String structureData) setStructure
(@NotNull String... structureData) setStructure
(@NotNull Structure structure) Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface xyz.xenondevs.invui.gui.Gui.Builder
build
-
Field Details
-
structure
The structure of theAbstractGui
being built. -
background
The backgroundItemProvider
of theAbstractGui
being built. -
modifiers
A list ofConsumers
that will be run after theAbstractGui
has been built. -
frozen
protected boolean frozenTheAbstractGui.frozen
state of theAbstractGui
being built. -
ignoreObscuredInventorySlots
protected boolean ignoreObscuredInventorySlotsTheAbstractGui.ignoreObscuredInventorySlots
state of theAbstractGui
being built.
-
-
Constructor Details
-
AbstractBuilder
public AbstractBuilder()
-
-
Method Details
-
setStructure
Description copied from interface:Gui.Builder
- Specified by:
setStructure
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
width
- The width of theGui
height
- The height of theGui
structureData
- The structure data- Returns:
- This
Gui Builder
-
setStructure
Description copied from interface:Gui.Builder
Sets theStructure
of theGui
using the given structure data Strings. Each String is interpreted as a row of theGui
. All Strings must have the same length.- Specified by:
setStructure
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
structureData
- The structure data- Returns:
- This
Gui Builder
-
setStructure
Description copied from interface:Gui.Builder
- Specified by:
setStructure
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
structure
- TheStructure
of theGui
- Returns:
- This
Gui.Builder
-
addIngredient
@NotNull public S addIngredient(char key, @NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Description copied from interface:Gui.Builder
Adds anItemStack
ingredient under the given key.- Specified by:
addIngredient
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
key
- The keyitemStack
- TheItemStack
- Returns:
- This
Gui Builder
-
addIngredient
Description copied from interface:Gui.Builder
Adds anItemProvider
ingredient under the given key.- Specified by:
addIngredient
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
key
- The keyitemProvider
- TheItemProvider
- Returns:
- This
Gui Builder
-
addIngredient
Description copied from interface:Gui.Builder
Adds anItem
ingredient under the given key.- Specified by:
addIngredient
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
key
- The keyitem
- TheItem
- Returns:
- This
Gui Builder
-
addIngredient
Description copied from interface:Gui.Builder
Adds anInventory
ingredient under the given key.- Specified by:
addIngredient
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
key
- The keyinventory
- TheInventory
- Returns:
- This
Gui Builder
-
addIngredient
@NotNull public S addIngredient(char key, @NotNull @NotNull Inventory inventory, @Nullable @Nullable ItemProvider background) Description copied from interface:Gui.Builder
Adds anInventory
ingredient under the given key.- Specified by:
addIngredient
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
key
- The keyinventory
- TheInventory
background
- TheItemProvider
for empty slots of theInventory
- Returns:
- This
Gui Builder
-
addIngredient
Description copied from interface:Gui.Builder
Adds aSlotElement
ingredient under the given key.- Specified by:
addIngredient
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
key
- The keyelement
- TheSlotElement
- Returns:
- This
Gui Builder
-
addIngredient
Description copied from interface:Gui.Builder
Adds aMarker
ingredient under the given key.- Specified by:
addIngredient
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
key
- The keymarker
- TheMarker
- Returns:
- This
Gui Builder
-
addIngredient
Description copied from interface:Gui.Builder
- Specified by:
addIngredient
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
key
- The keyitemSupplier
- TheSupplier
ofItems
- Returns:
- This
Gui Builder
-
addIngredientElementSupplier
@NotNull public S addIngredientElementSupplier(char key, @NotNull @NotNull Supplier<? extends SlotElement> elementSupplier) Description copied from interface:Gui.Builder
Adds aSupplier
ofSlotElements
ingredient under the given key.- Specified by:
addIngredientElementSupplier
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
key
- The keyelementSupplier
- TheSupplier
ofSlotElements
- Returns:
- This
Gui Builder
-
setBackground
Description copied from interface:Gui.Builder
Sets the background of theGui
.- Specified by:
setBackground
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
itemProvider
- TheItemProvider
for the background- Returns:
- This
Gui Builder
-
setBackground
Description copied from interface:Gui.Builder
Sets the background of theGui
.- Specified by:
setBackground
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
itemStack
- TheItemStack
for the background- Returns:
- This
Gui Builder
-
setFrozen
Description copied from interface:Gui.Builder
Sets whether theGui
should be frozen.- Specified by:
setFrozen
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
frozen
- Whether theGui
should be frozen- Returns:
- This
Gui Builder
-
setIgnoreObscuredInventorySlots
Description copied from interface:Gui.Builder
Sets whether it is possible to shift-click items into and cursor collect items from allInventory
slots of partially obscured embeddedInventories
.- Specified by:
setIgnoreObscuredInventorySlots
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
ignoreObscuredInventorySlots
- Whether obscuredInventory
slots should be ignored when shift-clicking and collecting to the cursor.- Returns:
- This
Gui Builder
-
addModifier
Description copied from interface:Gui.Builder
Sets the background of theGui
.- Specified by:
addModifier
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
modifier
- TheConsumer
for the background- Returns:
- This
Gui Builder
-
setModifiers
Description copied from interface:Gui.Builder
Sets the background of theGui
.- Specified by:
setModifiers
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Parameters:
modifiers
- TheConsumers
for the background- Returns:
- This
Gui Builder
-
applyModifiers
Applies themodifiers
to the givenAbstractGui
.- Parameters:
gui
- TheAbstractGui
to apply the modifiers to
-
clone
Description copied from interface:Gui.Builder
Clones the Gui Builder.- Specified by:
clone
in interfaceGui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> - Overrides:
clone
in classObject
- Returns:
- The cloned Gui Builder
-