Package xyz.xenondevs.invui.window
Class AbstractWindow.AbstractBuilder<W extends Window,S extends Window.Builder<W,S>>
java.lang.Object
xyz.xenondevs.invui.window.AbstractWindow.AbstractBuilder<W,S>
- Type Parameters:
W
- The type of the window.S
- The type of the builder.
- All Implemented Interfaces:
Cloneable
,Window.Builder<W,
S>
- Direct Known Subclasses:
AbstractSingleWindow.AbstractBuilder
,AbstractSplitWindow.AbstractBuilder
- Enclosing class:
AbstractWindow
public abstract static class AbstractWindow.AbstractBuilder<W extends Window,S extends Window.Builder<W,S>>
extends Object
implements Window.Builder<W,S>
Builder for a
AbstractWindow
.
This class should only be used directly if you're creating a custom AbstractWindow.AbstractBuilder
for a custom
AbstractWindow
implementation. Otherwise, use the static builder functions in the Window
interfaces,
such as Window.single()
to obtain a builder.
-
Nested Class Summary
Nested classes/interfaces inherited from interface xyz.xenondevs.invui.window.Window.Builder
Window.Builder.Double<W extends Window,
S extends Window.Builder.Double<W, S>>, Window.Builder.Normal<V, S extends Window.Builder.Normal<V, S>>, Window.Builder.Single<W extends Window, S extends Window.Builder.Single<W, S>> -
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected xyz.xenondevs.inventoryaccess.component.ComponentWrapper
protected org.bukkit.entity.Player
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddCloseHandler
(@NotNull Runnable closeHandler) Adds a close handler to theWindow
.addModifier
(@NotNull Consumer<@NotNull W> modifier) Adds a modifier to theWindow
.addOpenHandler
(@NotNull Runnable openHandler) Adds an open handler to theWindow
.addOutsideClickHandler
(@NotNull Consumer<@NotNull org.bukkit.event.inventory.InventoryClickEvent> outsideClickHandler) Adds an outside click handler to theWindow
.protected void
applyModifiers
(W window) build()
Builds theWindow
.clone()
Clones theWindow Builder
.void
open
(org.bukkit.entity.Player viewer) Builds and shows theWindow
to the specified viewer.setCloseable
(boolean closeable) Configures if theWindow
is closeable.setCloseHandlers
(@Nullable List<@NotNull Runnable> closeHandlers) Sets the close handlers of theWindow
.setModifiers
(@Nullable List<@NotNull Consumer<@NotNull W>> modifiers) Sets the modifiers of theWindow
.setOpenHandlers
(@Nullable List<@NotNull Runnable> openHandlers) Sets the open handlers of theWindow
.setOutsideClickHandlers
(@NotNull List<@NotNull Consumer<@NotNull org.bukkit.event.inventory.InventoryClickEvent>> outsideClickHandlers) Sets the outside click handlers of theWindow
.Sets the title of theWindow
.setTitle
(@NotNull net.md_5.bungee.api.chat.BaseComponent @NotNull [] title) Sets the title of theWindow
.setTitle
(@NotNull xyz.xenondevs.inventoryaccess.component.ComponentWrapper title) Sets the title of theWindow
.setViewer
(@NotNull org.bukkit.entity.Player viewer) Sets the viewer of theWindow
.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface xyz.xenondevs.invui.window.Window.Builder
build
-
Field Details
-
viewer
protected org.bukkit.entity.Player viewer -
title
protected xyz.xenondevs.inventoryaccess.component.ComponentWrapper title -
closeable
protected boolean closeable -
openHandlers
-
closeHandlers
-
outsideClickHandlers
-
modifiers
-
-
Constructor Details
-
AbstractBuilder
public AbstractBuilder()
-
-
Method Details
-
setViewer
Description copied from interface:Window.Builder
Sets the viewer of theWindow
.- Specified by:
setViewer
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
viewer
- The viewer of theWindow
- Returns:
- This
Window Builder
-
setTitle
@NotNull public S setTitle(@NotNull @NotNull xyz.xenondevs.inventoryaccess.component.ComponentWrapper title) Description copied from interface:Window.Builder
Sets the title of theWindow
.- Specified by:
setTitle
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
title
- The title of theWindow
- Returns:
- This
Window Builder
-
setTitle
@NotNull public S setTitle(@NotNull @NotNull net.md_5.bungee.api.chat.BaseComponent @NotNull [] title) Description copied from interface:Window.Builder
Sets the title of theWindow
.- Specified by:
setTitle
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
title
- The title of theWindow
- Returns:
- This
Window Builder
-
setTitle
Description copied from interface:Window.Builder
Sets the title of theWindow
.- Specified by:
setTitle
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
title
- The title of theWindow
- Returns:
- This
Window Builder
-
setCloseable
Description copied from interface:Window.Builder
Configures if theWindow
is closeable.- Specified by:
setCloseable
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
closeable
- If theWindow
is closeable- Returns:
- This
Window Builder
-
setOpenHandlers
Description copied from interface:Window.Builder
Sets the open handlers of theWindow
.- Specified by:
setOpenHandlers
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
openHandlers
- The open handlers of theWindow
- Returns:
- This
Window Builder
-
addOpenHandler
Description copied from interface:Window.Builder
Adds an open handler to theWindow
.- Specified by:
addOpenHandler
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
openHandler
- The open handler to add- Returns:
- This
Window Builder
-
setCloseHandlers
Description copied from interface:Window.Builder
Sets the close handlers of theWindow
.- Specified by:
setCloseHandlers
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
closeHandlers
- The close handlers of theWindow
- Returns:
- This
Window Builder
-
addCloseHandler
Description copied from interface:Window.Builder
Adds a close handler to theWindow
.- Specified by:
addCloseHandler
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
closeHandler
- The close handler to add- Returns:
- This
Window Builder
-
setOutsideClickHandlers
@NotNull public S setOutsideClickHandlers(@NotNull @NotNull List<@NotNull Consumer<@NotNull org.bukkit.event.inventory.InventoryClickEvent>> outsideClickHandlers) Description copied from interface:Window.Builder
Sets the outside click handlers of theWindow
.- Specified by:
setOutsideClickHandlers
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
outsideClickHandlers
- The outside click handlers of theWindow
- Returns:
- This
Window Builder
-
addOutsideClickHandler
@NotNull public S addOutsideClickHandler(@NotNull @NotNull Consumer<@NotNull org.bukkit.event.inventory.InventoryClickEvent> outsideClickHandler) Description copied from interface:Window.Builder
Adds an outside click handler to theWindow
.- Specified by:
addOutsideClickHandler
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
outsideClickHandler
- The outside click handler to add- Returns:
- This
Window Builder
-
setModifiers
Description copied from interface:Window.Builder
Sets the modifiers of theWindow
.- Specified by:
setModifiers
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
modifiers
- The modifiers of theWindow
- Returns:
- This
Window Builder
-
addModifier
Description copied from interface:Window.Builder
Adds a modifier to theWindow
.- Specified by:
addModifier
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
modifier
- The modifier to add- Returns:
- This
Window Builder
-
applyModifiers
-
build
Description copied from interface:Window.Builder
Builds theWindow
.- Specified by:
build
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Returns:
- The built
Window
-
open
public void open(org.bukkit.entity.Player viewer) Description copied from interface:Window.Builder
Builds and shows theWindow
to the specified viewer. If this method is used, the viewer does not need to be set usingWindow.Builder.setViewer(Player)
.- Specified by:
open
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Parameters:
viewer
- ThePlayer
to show theWindow
to.
-
clone
Description copied from interface:Window.Builder
Clones theWindow Builder
.- Specified by:
clone
in interfaceWindow.Builder<W extends Window,
S extends Window.Builder<W, S>> - Overrides:
clone
in classObject
- Returns:
- The cloned
Window Builder
-