Commit 0dbe077 1 parent 523f6fb commit 0dbe077 Copy full SHA for 0dbe077
File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
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 ` .
You can’t perform that action at this time.
0 commit comments