Ui

open class Ui(val player: Player, val shouldCloseInventory: Boolean = true, val onBuild: UiModel.() -> Unit = {}) : Listener

Representation of a UI that will be shown to a player

Parameters

player

the player that should see the UI

shouldCloseInventory

whether the UI should be able to be closed by the player or not (usually when pressing the ESC or inventory key)

onBuild

the function that will be called when the UI is built

Constructors

Link copied to clipboard
constructor(player: Player, shouldCloseInventory: Boolean = true, onBuild: UiModel.() -> Unit = {})

Properties

Link copied to clipboard
var inventory: Inventory?
Link copied to clipboard
val onBuild: UiModel.() -> Unit
Link copied to clipboard
val player: Player
Link copied to clipboard

Functions

Link copied to clipboard
fun close(): Ui

Closes the UI

Link copied to clipboard
fun onClick(e: InventoryClickEvent)
Link copied to clipboard
fun onDrag(e: InventoryDragEvent)
Link copied to clipboard
fun onQuit(e: PlayerQuitEvent)
Link copied to clipboard
fun open(): Ui

Opens the UI (if it's not already open)

Link copied to clipboard
fun stop(): Ui

Prevents the Ui from reopening