-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
523f6fb
commit 0dbe077
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Items | ||
|
||
The documentation for items are WIP, but here's a simple implementation while you wait: | ||
|
||
```java | ||
public class MyItem implements CaramelItem { | ||
|
||
@Override | ||
public CaramelItemDetail getDetails() { | ||
return CaramelItemDetail.builder() | ||
.id("item_identifier") // Required | ||
.defaultStack(1) // Required | ||
.modelData(0) // Optional - Custom Model Data | ||
.itemBase(Material.PAPER) // Required | ||
.itemName(CaramelUtility.colorcomp("<gold><bold>Supports miniMessage")) // Required | ||
.lore(Arrays.asList("Lore <red>is cool<yellow>!")) // Required | ||
.build(); | ||
} | ||
|
||
@Override | ||
public ItemStack modifyBeforeFinalizing(ItemStack item) { | ||
// You can add custom modifications (attributes) here. | ||
// Return the item back to keep it the same. | ||
return item; | ||
} | ||
|
||
@Override | ||
public void onItemUse(ClickType type, ItemStack item, PlayerInteractEvent event) { | ||
// Handle interactions here. | ||
// ClickType is a dev.klash.caramel.items, not bukkit. | ||
event.getPlayer().sendMessage(CaramelUtility.colorcomp("Hello!")); | ||
} | ||
} | ||
``` | ||
|
||
Please see Commands for registering, but use `Caramel.getInstance().items` and define it as a `CaramelItem`. |