@@ -99,6 +99,7 @@ command("twitter") {
99
99
// args - Array<String>
100
100
101
101
sender.sendMessage(+ " &eFollow me on Twitter :D &atwitter.com/DevSrSouza" )
102
+ }
102
103
```
103
104
104
105
Item meta DSL and another stuffs
@@ -107,12 +108,12 @@ command("some-name") {
107
108
108
109
if (sender is Player ) { // checking if CommandSender is a player
109
110
val player = sender as Player
110
- player.vault.economy.deposit(2500 ) // you can see more about the vault api on KVault.kt
111
+ player.vault.economy.deposit(2500.0 ) // you can see more about the vault api on KVault.kt
111
112
112
113
// lets make a item more easy with kotlin and ItemMeta DSL
113
114
val gem = ItemStack (Material .DIAMOND ).apply {
114
115
amount = 5
115
- meta<ItemMeta > { // here you can put any meta type you wont, like BannerMeta(if the item isso a banner)
116
+ meta<ItemMeta > { // here you can put any meta type you wont, like BannerMeta(if the item is a banner)
116
117
// here is the same idea of event block but here you only que put the ItemMeta type, like BannerMeta, BookMeta
117
118
displayName = + " &bGem"
118
119
}
@@ -136,4 +137,51 @@ command("some-name") {
136
137
}
137
138
```
138
139
140
+ Menu creator DSL
141
+ ``` kotlin
142
+ // okay, lets make a Menu
143
+ // fun createMenu(displayname: String, lines: Int = 3, cancel: Boolean = false, block: Menu.() -> Unit)
144
+ val myMenu = createMenu(+ " &cWarps" , cancel = true ) { // cancel true to cancel player interact with inventory by default
145
+ // this menu will be a menu with 3 lines (27 slots) and the name "Warps" in red
146
+ // this block is a Menu
147
+
148
+ // registering a slot
149
+ slot(2 , 4 ) { // Line, Slot
150
+ // inside of this block will be a Slot
151
+ item = ItemStack (Material .DIAMOND_SWORD ).apply {
152
+ addEnchantment(Enchantment .DAMAGE_ALL , 5 )
153
+
154
+ meta<ItemMeta > {
155
+ displayName = + " &4Arena PvP"
156
+ }
157
+ }
158
+
159
+ onClick {
160
+ player.teleport(Location (player.world, 250 , 70 , - 355 ))
161
+ close() // close the menu
162
+ }
163
+ }
164
+
165
+ slot(2 , 6 ) {
166
+ item = ItemStack (Material .GOLD ).apply {
167
+ meta<ItemMeta > {
168
+ displayName = + " &6Shop"
169
+ }
170
+ }
171
+
172
+ onClick {
173
+ player.teleport(Location (player.world, 2399 , 70 , - 1234 ))
174
+ close() // close the menu
175
+ }
176
+ }
177
+
178
+ // now we need a command to open the menu to the player
179
+ command(" warps" ) {
180
+ if (sender is Player ) {
181
+ val player = sender as Player
182
+ myMenu.openToPlayer(player) // here we open the menu to de Player
183
+ }
184
+ }
185
+ ```
186
+
139
187
0 commit comments