-
Notifications
You must be signed in to change notification settings - Fork 1
Creating a ClickableItems
Dalton edited this page Apr 24, 2022
·
4 revisions
Creating a ClickableItem is rather simple:
ClickableItem item = new ClickableItem(Material.STONE, 1);To handle the ClickableItem's InventoryClickEvent, you simply call the onClick functional interface:
ClickableItem item = new ClickableItem(Material.STONE, 1)
.onClick((onClick) -> {
final InventoryClickEvent event = onClick.clickEvent();
// Do things with event for this specific item
});Make sure you read Creating a PluginInventory first before reading the rest of this guide
There is a few different methods:
1. Setting a specific slots ClickableItem
```java
ClickableItem item = new ClickableItem(Material.STONE, 1)
.onClick((onClick) -> {
final InventoryClickEvent event = onClick.clickEvent();
// Do things with event for this specific item
});
PluginInventory inventory = new PluginInventory(9, "&a&lInventory")
.setClickableItemAtSlot(0, item);
```
Page written by: Dalton Burchard
- Your main class and you
- Editing API Settings (Optional)
- Creating an PluginInventory
- Creating Clickable items
- (Not added yet) Examples