Package org.yuemi.libs.api.gui
Interface AnvilInputBuilder
public interface AnvilInputBuilder
Builder for creating Anvil-based text input GUIs.
-
Method Summary
Modifier and TypeMethodDescription@NotNull AnvilInputBuilderclosePolicy(@NotNull ClosePolicy policy) Sets the close policy for this Anvil GUI.@NotNull AnvilInputBuilderinitialText(@NotNull String text) Sets the initial text in the rename slot.@NotNull AnvilInputBuilderleftItem(@NotNull org.bukkit.inventory.ItemStack item) Sets the left input item stack.@NotNull AnvilInputBuildermaxLength(int limit) Sets the maximum character limit for the input.@NotNull AnvilInputBuilderSets the callback executed when the GUI is closed without submitting.@NotNull AnvilInputBuilderonSubmit(@NotNull BiConsumer<org.bukkit.entity.Player, String> callback) Sets the callback executed when the player submits the input (clicks the output slot).voidopen(@NotNull org.bukkit.entity.Player player) Opens the anvil GUI for the specified player.@NotNull AnvilInputBuilderSets the title of the anvil GUI.
-
Method Details
-
title
Sets the title of the anvil GUI.- Parameters:
title- the title- Returns:
- this builder
-
initialText
Sets the initial text in the rename slot.- Parameters:
text- the initial text- Returns:
- this builder
-
leftItem
Sets the left input item stack.- Parameters:
item- the item stack- Returns:
- this builder
-
maxLength
Sets the maximum character limit for the input.- Parameters:
limit- the max character length- Returns:
- this builder
-
onSubmit
@NotNull @NotNull AnvilInputBuilder onSubmit(@NotNull @NotNull BiConsumer<org.bukkit.entity.Player, String> callback) Sets the callback executed when the player submits the input (clicks the output slot). The callback receives the player and the typed text.- Parameters:
callback- the submit callback- Returns:
- this builder
-
onClose
@NotNull @NotNull AnvilInputBuilder onClose(@NotNull @NotNull Consumer<org.bukkit.entity.Player> callback) Sets the callback executed when the GUI is closed without submitting.- Parameters:
callback- the close callback- Returns:
- this builder
-
closePolicy
Sets the close policy for this Anvil GUI.- Parameters:
policy- the close policy- Returns:
- this builder
-
open
void open(@NotNull @NotNull org.bukkit.entity.Player player) Opens the anvil GUI for the specified player.- Parameters:
player- the player
-