Class GuiButtonBuilder
java.lang.Object
github.nighter.smartspawner.api.gui.GuiButtonBuilder
Builder for creating
GuiButtonData instances programmatically.
Used in the SmartSpawner Developer API to define custom GUI buttons.
Example usage:
GuiButtonData button = new GuiButtonBuilder()
.slot(11)
.material(Material.CHEST)
.action("click", "open_storage")
.build();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an action for a specific click type.build()Builds theGuiButtonDatainstance.buttonType(String buttonType) Sets the button type identifier.Sets a condition for this button to be shown.Sets a button cooldown using SmartSpawner's config duration format.cooldownTicks(long cooldownTicks) Sets a button cooldown in server ticks.customTexture(String customTexture) Sets a custom texture hash for PLAYER_HEAD material.enabled(boolean enabled) Sets whether this button is enabled.Marks this button as the spawner info button.infoButton(boolean infoButton) Sets whether this button is the spawner info button.material(org.bukkit.Material material) Sets the material for this button.noSound()Removes the configured click sound.slot(int slot) Sets the slot position for this button.Sets the sound played when the button click is accepted.Sets the sound played when the button click is accepted.successSound(String soundName) successSound(String soundName, float volume, float pitch) successSound(String clickType, String soundName) successSound(String clickType, String soundName, float volume, float pitch)
-
Constructor Details
-
GuiButtonBuilder
public GuiButtonBuilder()
-
-
Method Details
-
buttonType
Sets the button type identifier.- Parameters:
buttonType- the button type (e.g., "slot_11")- Returns:
- this builder
-
slot
Sets the slot position for this button.- Parameters:
slot- the 1-based slot number used by SmartSpawner YAML layouts- Returns:
- this builder
-
material
Sets the material for this button.- Parameters:
material- the Bukkit material- Returns:
- this builder
-
enabled
Sets whether this button is enabled.- Parameters:
enabled- true if enabled- Returns:
- this builder
-
condition
Sets a condition for this button to be shown.- Parameters:
condition- the condition string (e.g., "sell_integration")- Returns:
- this builder
-
action
Adds an action for a specific click type.- Parameters:
clickType- the click type (e.g., "click", "left_click", "right_click")action- the action to perform- Returns:
- this builder
-
infoButton
Marks this button as the spawner info button.- Returns:
- this builder
-
infoButton
Sets whether this button is the spawner info button.- Parameters:
infoButton- true if info button- Returns:
- this builder
-
customTexture
Sets a custom texture hash for PLAYER_HEAD material.- Parameters:
customTexture- the texture hash (without URL prefix)- Returns:
- this builder
-
cooldownTicks
Sets a button cooldown in server ticks. Zero disables cooldown.- Parameters:
cooldownTicks- cooldown in server ticks- Returns:
- this builder
-
cooldown
Sets a button cooldown using SmartSpawner's config duration format.- Parameters:
duration- duration such as "5s", "1m_30s", or a numeric tick value- Returns:
- this builder
-
sound
Sets the sound played when the button click is accepted.- Parameters:
soundName- Bukkit sound key- Returns:
- this builder
-
sound
Sets the sound played when the button click is accepted.- Parameters:
soundName- Bukkit sound keyvolume- sound volumepitch- sound pitch- Returns:
- this builder
-
noSound
-
successSound
-
successSound
-
failSound
-
failSound
-
sound
-
sound
-
successSound
-
successSound
-
failSound
-
failSound
-
build
-