SimpleGUI

class SimpleGUI(player: Player) : InventoryGUI

A simple GUI class that provides basic inventory GUI functionality. It allows setting up buttons, listeners, and background materials for GUI customization. This class can be extended to create more complex GUIs.

Since

1.0.0

Author

RiriFa

Parameters

player

The player who will view the GUI.

See also

Constructors

Link copied to clipboard
constructor(player: Player)

Properties

Link copied to clipboard

Represents the list of buttons to be displayed in this inventory GUI. Each button corresponds to a slot and can define its own material, name, custom data, and click behavior.

Link copied to clipboard

Functions

Link copied to clipboard

Adds a single item to the existing item list.

Link copied to clipboard
open override fun build(): InventoryGUI

Abstract method for building the inventory GUI. This method should be implemented by subclasses to define the layout and items of the GUI.

Link copied to clipboard
fun close()

Closes the inventory for the player.

Link copied to clipboard
open override fun getAllButtons(): List<Button>
Link copied to clipboard
fun getBackgroundMaterial(): Material?

Gets the background material set for the inventory GUI.

Link copied to clipboard
open override fun getInventory(): Inventory

Returns the inventory associated with this GUI.

Link copied to clipboard

Gets the current listener associated with this GUI.

Link copied to clipboard
fun getSize(): Int?

Gets the size of the inventory GUI.

Link copied to clipboard
fun getTitle(): Component?

Gets the title of this GUI.

Link copied to clipboard
fun onClose(block: (SimpleGUI) -> Unit): SimpleGUI
Link copied to clipboard
fun open()

Opens the inventory for the player.

Link copied to clipboard
fun setBackground(background: Material): InventoryGUI

Sets the background material for the inventory GUI.

Link copied to clipboard

Sets multiple items at once for the GUI. This replaces the existing item list.

Link copied to clipboard

Sets the listener for handling GUI events.

Link copied to clipboard
fun setShouldCallGlobalListener(shouldCallGlobalListener: Boolean): InventoryGUI

Sets whether the global listener should be called on inventory events.

Link copied to clipboard

Sets the size of the inventory GUI.

Link copied to clipboard
fun setTitle(title: Component): InventoryGUI

Sets the title of the inventory GUI.

Link copied to clipboard

Indicates whether the global listener should be called on inventory events.