Skip to content

Commit 0dbe077

Browse files
Create items.md
1 parent 523f6fb commit 0dbe077

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

docs/items.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Items
2+
3+
The documentation for items are WIP, but here's a simple implementation while you wait:
4+
5+
```java
6+
public class MyItem implements CaramelItem {
7+
8+
@Override
9+
public CaramelItemDetail getDetails() {
10+
return CaramelItemDetail.builder()
11+
.id("item_identifier") // Required
12+
.defaultStack(1) // Required
13+
.modelData(0) // Optional - Custom Model Data
14+
.itemBase(Material.PAPER) // Required
15+
.itemName(CaramelUtility.colorcomp("<gold><bold>Supports miniMessage")) // Required
16+
.lore(Arrays.asList("Lore <red>is cool<yellow>!")) // Required
17+
.build();
18+
}
19+
20+
@Override
21+
public ItemStack modifyBeforeFinalizing(ItemStack item) {
22+
// You can add custom modifications (attributes) here.
23+
// Return the item back to keep it the same.
24+
return item;
25+
}
26+
27+
@Override
28+
public void onItemUse(ClickType type, ItemStack item, PlayerInteractEvent event) {
29+
// Handle interactions here.
30+
// ClickType is a dev.klash.caramel.items, not bukkit.
31+
event.getPlayer().sendMessage(CaramelUtility.colorcomp("Hello!"));
32+
}
33+
}
34+
```
35+
36+
Please see Commands for registering, but use `Caramel.getInstance().items` and define it as a `CaramelItem`.

0 commit comments

Comments
 (0)