add item builder docs
This commit is contained in:
BIN
guide/docs/extensions/img/sword.png
Normal file
BIN
guide/docs/extensions/img/sword.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
27
guide/docs/extensions/itemBuilder.md
Normal file
27
guide/docs/extensions/itemBuilder.md
Normal file
@@ -0,0 +1,27 @@
|
||||
## Create an itemStack
|
||||
|
||||
Spigots ItemBuilder is often painful to use and confusing, especially for beginners.
|
||||
|
||||
With KSpigot itemBuilders you have an easy to use ItemBuilder and you don´t have to worry about things like itemMeta again.
|
||||
|
||||
|
||||
### Create a simple item
|
||||
```kotlin
|
||||
val sword = itemStack(Material.GOLDEN_SWORD) {
|
||||
amount = 3
|
||||
addEnchantment(Enchantment.KNOCKBACK, 2)
|
||||
meta {
|
||||
name = "${KColors.GOLD}Magic Sword"
|
||||
isUnbreakable = true
|
||||
addLore {
|
||||
+ "This sword is truly special."
|
||||
+ "Try it!"
|
||||
}
|
||||
customModel = 1001
|
||||
flag(ItemFlag.HIDE_UNBREAKABLE)
|
||||
}
|
||||
}
|
||||
```
|
||||
### This results in following item
|
||||
|
||||

|
@@ -37,3 +37,4 @@ nav:
|
||||
- Extensions:
|
||||
- Event listener: extensions/listener.md
|
||||
- Tasks: extensions/tasks.md
|
||||
- Item Builder: extensions/itemBuilder.md
|
||||
|
Reference in New Issue
Block a user