Package org.yuemi.libs.api.gui
Interface GuiBuilder
public interface GuiBuilder
Fluent builder for creating Gui instances.
-
Method Summary
Modifier and TypeMethodDescription@NotNull GuiBuilderAdds an already built layout layer to the GUI.@NotNull Guibuild()Builds and returns the final Gui instance.@NotNull GuiBuilderclosePolicy(@NotNull ClosePolicy policy) Sets the close policy for the GUI.@NotNull GuiBuildercreateLayer(@NotNull String id, int priority, @NotNull Consumer<GuiLayerBuilder> configurator) Inline constructs and configures a layer inside the GUI builder.@NotNull GuiBuilderSets the callback executed when the GUI is closed.@NotNull GuiBuilderrows(int rows) Sets the number of rows of the GUI.@NotNull GuiBuilderSets the title of the GUI.
-
Method Details
-
title
Sets the title of the GUI.- Parameters:
title- the title- Returns:
- this builder
-
rows
Sets the number of rows of the GUI.- Parameters:
rows- the number of rows (1 to 6)- Returns:
- this builder
-
addLayer
Adds an already built layout layer to the GUI.- Parameters:
layer- the layer- Returns:
- this builder
-
createLayer
@NotNull @NotNull GuiBuilder createLayer(@NotNull @NotNull String id, int priority, @NotNull @NotNull Consumer<GuiLayerBuilder> configurator) Inline constructs and configures a layer inside the GUI builder.- Parameters:
id- the unique ID of the layerpriority- the priority of the layerconfigurator- lambda consumer to configure slots in this layer- Returns:
- this builder
-
closePolicy
Sets the close policy for the GUI.- Parameters:
policy- the close policy- Returns:
- this builder
-
onClose
Sets the callback executed when the GUI is closed.- Parameters:
callback- the close callback- Returns:
- this builder
-
build
Builds and returns the final Gui instance.- Returns:
- the constructed Gui
-