Class ViewConfigBuilder
java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.config.ViewConfigBuilder
Fluent, mutable builder for
ViewConfig, used in View.onInit;
build() validates and freezes the configuration.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull ViewConfigBuilderapplyPlaceholders(boolean apply) Sets whether placeholders are applied at paint time (defaulttrue).@NotNull ViewConfigbuild()Validates and freezes the configuration.@NotNull ViewConfigBuildercancelOnClick(boolean cancel) Sets whether clicks are cancelled by default (defaulttrue).@NotNull ViewConfigBuildercancelOnDrag(boolean cancel) Sets whether drags are cancelled by default (defaulttrue).@NotNull ViewConfigBuilderSets the layout rows; each row must be non-null and exactlyLayout.ROW_WIDTHcharacters, validated atbuild().@NotNull ViewConfigBuilderrows(int rows) Sets the explicit row count; optional when a layout is present (inferred).@NotNull ViewConfigBuilderscheduleUpdate(long intervalTicks) Schedules periodic updates; values<= 0disable scheduling (the default).@NotNull ViewConfigBuilderSets the inventory title (legacy color codes allowed).
-
Constructor Details
-
ViewConfigBuilder
public ViewConfigBuilder()
-
-
Method Details
-
title
Sets the inventory title (legacy color codes allowed).- Parameters:
title- the title- Returns:
- this builder
-
rows
Sets the explicit row count; optional when a layout is present (inferred).- Parameters:
rows- the row count, validated to 1-6 atbuild()- Returns:
- this builder
-
layout
Sets the layout rows; each row must be non-null and exactlyLayout.ROW_WIDTHcharacters, validated atbuild().- Parameters:
rows- the layout rows- Returns:
- this builder
-
cancelOnClick
Sets whether clicks are cancelled by default (defaulttrue).- Parameters:
cancel- the cancel-on-click default- Returns:
- this builder
-
cancelOnDrag
Sets whether drags are cancelled by default (defaulttrue).- Parameters:
cancel- the cancel-on-drag default- Returns:
- this builder
-
scheduleUpdate
Schedules periodic updates; values<= 0disable scheduling (the default).- Parameters:
intervalTicks- the update interval in ticks- Returns:
- this builder
-
applyPlaceholders
Sets whether placeholders are applied at paint time (defaulttrue).- Parameters:
apply- the apply-placeholders flag- Returns:
- this builder
-
build
Validates and freezes the configuration.- Returns:
- the immutable config
- Throws:
ViewConfigurationException- if the title is missing, rows (explicit or inferred from the layout height) are outside 1-6, a layout row is null or not exactlyLayout.ROW_WIDTHcharacters wide, rows and layout are inconsistent, or neither rows nor layout is set
-