Menu

interface Menu

Represents a custom menu in Housing.

Menus have a title, a variable size, and contain menu elements each holding an item and optionally an action container.

Implementations perform sequential behavior and therefore expose suspend functions for better interaction with Housing.

Types

Link copied to clipboard
interface MenuElement

Represents a single element (slot) within a menu.

Properties

Link copied to clipboard
abstract var title: String

The title of this menu. This technically does not need to be unique but having multiple menus with the same title will mess with the API's ability to act on a specific menu, as the title is our only identifier.

Functions

Link copied to clipboard
abstract suspend fun delete()

Deletes this menu.

Link copied to clipboard
abstract suspend fun getAllMenuElements(): Array<Menu.MenuElement>

Returns all menu elements as an array.

Link copied to clipboard
abstract suspend fun getMenuElement(index: Int): Menu.MenuElement

Retrieves the menu element at the given zero-based index.

Link copied to clipboard
abstract suspend fun getMenuSize(): Int

Returns the current size (number of rows) of the menu.

Link copied to clipboard
open suspend fun getTitle(): String

Returns the current title of this menu.

Link copied to clipboard
abstract suspend fun setMenuSize(newSize: Int): Menu

Changes the size of the menu.

Link copied to clipboard
abstract suspend fun setTitle(newTitle: String): Menu

Sets a new title for this menu.