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 ofAbstractGuithis 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
FieldsModifier and TypeFieldDescriptionprotected ItemProviderThe backgroundItemProviderof theAbstractGuibeing built.protected booleanTheAbstractGui.frozenstate of theAbstractGuibeing built.protected booleanTheAbstractGui.ignoreObscuredInventorySlotsstate of theAbstractGuibeing built.A list ofConsumersthat will be run after theAbstractGuihas been built.protected StructureThe structure of theAbstractGuibeing built. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddIngredient(char key, @NotNull Supplier<? extends Item> itemSupplier) addIngredient(char key, @NotNull org.bukkit.inventory.ItemStack itemStack) Adds anItemStackingredient under the given key.addIngredient(char key, @NotNull SlotElement element) Adds aSlotElementingredient under the given key.addIngredient(char key, @NotNull Marker marker) Adds aMarkeringredient under the given key.addIngredient(char key, @NotNull Inventory inventory) Adds anInventoryingredient under the given key.addIngredient(char key, @NotNull Inventory inventory, @Nullable ItemProvider background) Adds anInventoryingredient under the given key.addIngredient(char key, @NotNull Item item) Adds anItemingredient under the given key.addIngredient(char key, @NotNull ItemProvider itemProvider) Adds anItemProvideringredient under the given key.addIngredientElementSupplier(char key, @NotNull Supplier<? extends SlotElement> elementSupplier) Adds aSupplierofSlotElementsingredient under the given key.addModifier(@NotNull Consumer<@NotNull G> modifier) Sets the background of theGui.protected voidapplyModifiers(G gui) Applies themodifiersto 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 theGuishould be frozen.setIgnoreObscuredInventorySlots(boolean ignoreObscuredInventorySlots) Sets whether it is possible to shift-click items into and cursor collect items from allInventoryslots 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, waitMethods inherited from interface xyz.xenondevs.invui.gui.Gui.Builder
build
-
Field Details
-
structure
The structure of theAbstractGuibeing built. -
background
The backgroundItemProviderof theAbstractGuibeing built. -
modifiers
A list ofConsumersthat will be run after theAbstractGuihas been built. -
frozen
protected boolean frozenTheAbstractGui.frozenstate of theAbstractGuibeing built. -
ignoreObscuredInventorySlots
protected boolean ignoreObscuredInventorySlotsTheAbstractGui.ignoreObscuredInventorySlotsstate of theAbstractGuibeing built.
-
-
Constructor Details
-
AbstractBuilder
public AbstractBuilder()
-
-
Method Details
-
setStructure
Description copied from interface:Gui.Builder- Specified by:
setStructurein interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Parameters:
width- The width of theGuiheight- The height of theGuistructureData- The structure data- Returns:
- This
Gui Builder
-
setStructure
Description copied from interface:Gui.BuilderSets theStructureof theGuiusing the given structure data Strings. Each String is interpreted as a row of theGui. All Strings must have the same length.- Specified by:
setStructurein 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:
setStructurein interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Parameters:
structure- TheStructureof theGui- Returns:
- This
Gui.Builder
-
addIngredient
@NotNull public S addIngredient(char key, @NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Description copied from interface:Gui.BuilderAdds anItemStackingredient under the given key.- Specified by:
addIngredientin 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.BuilderAdds anItemProvideringredient under the given key.- Specified by:
addIngredientin 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.BuilderAdds anItemingredient under the given key.- Specified by:
addIngredientin 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.BuilderAdds anInventoryingredient under the given key.- Specified by:
addIngredientin 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.BuilderAdds anInventoryingredient under the given key.- Specified by:
addIngredientin interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Parameters:
key- The keyinventory- TheInventorybackground- TheItemProviderfor empty slots of theInventory- Returns:
- This
Gui Builder
-
addIngredient
Description copied from interface:Gui.BuilderAdds aSlotElementingredient under the given key.- Specified by:
addIngredientin 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.BuilderAdds aMarkeringredient under the given key.- Specified by:
addIngredientin 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:
addIngredientin interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Parameters:
key- The keyitemSupplier- TheSupplierofItems- Returns:
- This
Gui Builder
-
addIngredientElementSupplier
@NotNull public S addIngredientElementSupplier(char key, @NotNull @NotNull Supplier<? extends SlotElement> elementSupplier) Description copied from interface:Gui.BuilderAdds aSupplierofSlotElementsingredient under the given key.- Specified by:
addIngredientElementSupplierin interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Parameters:
key- The keyelementSupplier- TheSupplierofSlotElements- Returns:
- This
Gui Builder
-
setBackground
Description copied from interface:Gui.BuilderSets the background of theGui.- Specified by:
setBackgroundin interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Parameters:
itemProvider- TheItemProviderfor the background- Returns:
- This
Gui Builder
-
setBackground
Description copied from interface:Gui.BuilderSets the background of theGui.- Specified by:
setBackgroundin interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Parameters:
itemStack- TheItemStackfor the background- Returns:
- This
Gui Builder
-
setFrozen
Description copied from interface:Gui.BuilderSets whether theGuishould be frozen.- Specified by:
setFrozenin interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Parameters:
frozen- Whether theGuishould be frozen- Returns:
- This
Gui Builder
-
setIgnoreObscuredInventorySlots
Description copied from interface:Gui.BuilderSets whether it is possible to shift-click items into and cursor collect items from allInventoryslots of partially obscured embeddedInventories.- Specified by:
setIgnoreObscuredInventorySlotsin interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Parameters:
ignoreObscuredInventorySlots- Whether obscuredInventoryslots should be ignored when shift-clicking and collecting to the cursor.- Returns:
- This
Gui Builder
-
addModifier
Description copied from interface:Gui.BuilderSets the background of theGui.- Specified by:
addModifierin interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Parameters:
modifier- TheConsumerfor the background- Returns:
- This
Gui Builder
-
setModifiers
Description copied from interface:Gui.BuilderSets the background of theGui.- Specified by:
setModifiersin interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Parameters:
modifiers- TheConsumersfor the background- Returns:
- This
Gui Builder
-
applyModifiers
Applies themodifiersto the givenAbstractGui.- Parameters:
gui- TheAbstractGuito apply the modifiers to
-
clone
Description copied from interface:Gui.BuilderClones the Gui Builder.- Specified by:
clonein interfaceGui.Builder<G extends Gui,S extends Gui.Builder<G, S>> - Overrides:
clonein classObject- Returns:
- The cloned Gui Builder
-