GuiBuilder

A builder class for constructing and managing a GUI interface in a Bukkit-based Minecraft plugin.

This class allows you to define a GUI with buttons, handle interactions, manage redirections between GUIs, and perform various customizations to the GUI.

Types

Link copied to clipboard
object Companion
Link copied to clipboard

A container for storing predefined button templates.

Functions

Link copied to clipboard
fun button(slot: Int, template: ButtonBuilder)

Registers a button in the GUI from a predefined ButtonBuilder template.

fun button(slot: Int, builder: ButtonBuilder.() -> Unit)

Registers a button in the GUI using the ButtonBuilder DSL.

fun button(slot: Int, template: ButtonBuilder, override: ButtonBuilder.() -> Unit)

Registers a button in the GUI by overriding properties of an existing ButtonBuilder template.

fun button(slot: Int, item: ItemStack, scope: EventScope<InventoryClickEvent>.() -> Unit = {}, metadata: Map<String, Any> = emptyMap(), delay: Long = 0, debounce: Long = 0, throttle: Long = 0, onClick: (InventoryClickEvent) -> Unit)

Registers a custom button in the GUI.

Link copied to clipboard
fun chainRedirect(player: Player, target: GuiBuilder)

Redirects the player to a target GUI and chains metadata between the two GUIs.

Link copied to clipboard
fun getInventory(): Inventory

Retrieves the Inventory representing the GUI.

Link copied to clipboard
fun <T> getMeta(key: String): T?

Retrieves the metadata associated with a key.

Link copied to clipboard

Checks if the GUI has a specific metadata key.

Link copied to clipboard

Retrieves all metadata keys associated with the GUI.

Link copied to clipboard
fun open(player: Player)

Opens the GUI for the specified player.

Link copied to clipboard
fun populateWithEquipment(player: Player)

Populates the GUI with the player's equipment and hotbar items.

Link copied to clipboard
fun redirectTo(player: Player, target: GuiBuilder)

Redirects the player to a target GUI.

Link copied to clipboard
fun redirectToWithMeta(player: Player, target: GuiBuilder, meta: Map<String, Any>)

Redirects the player to a target GUI with additional metadata.

Link copied to clipboard

Removes a specific metadata key from the GUI.

Link copied to clipboard
fun <T> setMeta(key: String, value: T): GuiBuilder

Sets metadata for the GUI.