Skip to content

GUI Item

This is a guide to creating items in a GUI. You can create items in a GUI with the item method.

Create

You can create an item in a GUI with the item method. Als every form from the GUI Page is an item, so you can use all forms as items.

GUI.kt
page(index) {
    item(index, itemStack)
}
GUI.java
page(index, page -> {
    page.item(index, itemStack);
});

onClick

You can add a onClick event to an item. This event is called when a player clicks on the item. It returns a GUIClickEvent.

GUI.kt
page(index) {
    item(index, itemStack) {
        onClick = { event ->
            // Your code
        }
    }
}
GUI.java
page(index, page -> {
    page.item(index, itemStack, item -> {
        item.onClick(event -> {
            // Your code
        });
    });
});

Conditions

You can add conditions to an item. When the condition is true, the Condition-Item is shown. When the condition is false, the normal item is shown. You can use the condition method to add a condition to an item.

GUI.kt
page(index) {
    item(index, itemStack) {
        condition(contition, itemStack)
    }
}
GUI.java
page(index, page -> {
    page.item(index, itemStack, item -> {
        item.condition(contition, itemStack);
    });
});