diff --git a/docs/items.md b/docs/items.md new file mode 100644 index 0000000..7b2e704 --- /dev/null +++ b/docs/items.md @@ -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("Supports miniMessage")) // Required + .lore(Arrays.asList("Lore is cool!")) // 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`.