@@ -11,14 +11,16 @@ KotlinBukkitAPI is an API for Bukkit/SpigotAPI using the cool and nifty features
11
11
## Dependencies
12
12
| Name | Version |
13
13
| --- | --- |
14
- | [ Spigot API] ( https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/ ) | 1.8.8 |
14
+ | [ Spigot API] ( https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/ ) | 1.8.8+ |
15
15
16
16
## Dependencies Embed
17
17
| Name | Version |
18
18
| --- | --- |
19
- | Kotlin STD | 1.3.71 |
19
+ | Kotlin STD + JDK8 | 1.3.71 |
20
20
| [ Kotlinx-coroutines] ( https://github.com/Kotlin/kotlinx.coroutines/ ) | 1.3.5 |
21
21
| [ Skedule] ( https://github.com/okkero/Skedule ) | 1.2.6 |
22
+ | [ Kotlinx.serialization] ( https://github.com/Kotlin/kotlinx.serialization ) | 0.20.0 |
23
+ | [ KAML] ( https://github.com/charleskorn/kaml ) | 0.18.1 |
22
24
23
25
## Modules
24
26
| Module | Description |
@@ -27,40 +29,22 @@ KotlinBukkitAPI is an API for Bukkit/SpigotAPI using the cool and nifty features
27
29
| Architecture | Help you with the Architecture of your plugin providing KotlinPlugin base and Lifecycle Listener |
28
30
| Plugins | Extensions for others plugins like Vault, PlaceholderAPI and others |
29
31
| Exposed(0.21.1) | Extensions for SQL framework [ Exposed] ( https://github.com/JetBrains/Exposed/ ) |
30
- | Kotlinx. Serialization(0.20.0) | Extensions for [ Kotlinx.serialization] ( https://github.com/Kotlin/kotlinx.serialization ) |
32
+ | Serialization(0.20.0) | Extensions for [ Kotlinx.serialization] ( https://github.com/Kotlin/kotlinx.serialization ) |
31
33
32
- # Links
33
- - [ Starter project using KotlinBukkitAPI] ( https://github.com/KotlinMinecraft/KBAPI-StarterProject/ )
34
- - [ Examples and ** documentation** ] ( https://github.com/DevSrSouza/KotlinBukkitAPI/wiki/ )
35
- - [ Clone and building] ( https://github.com/DevSrSouza/KotlinBukkitAPI/wiki/Clone-and-build )
34
+ ## [ Documentation] ( https://github.com/DevSrSouza/KotlinBukkitAPI/wiki/ )
36
35
37
- # [ Download] ( http://jenkins.devsrsouza.com.br/job/KotlinBukkitAPI/ )
36
+ ## [ Download] ( http://jenkins.devsrsouza.com.br/job/KotlinBukkitAPI/ )
38
37
39
- # Setup for development
38
+ ## Others resources
39
+ - [ Starter project using KotlinBukkitAPI] ( https://github.com/KotlinMinecraft/KBAPI-StarterProject/ )
40
40
41
- First of all, you need to put KotlinBukkitAPI as a dependency on your ** plugin.yml**
42
- ``` yaml
43
- depend : [KotlinBukkitAPI]
44
- ` ` `
41
+ ## [ Setup for development] ( https://github.com/DevSrSouza/KotlinBukkitAPI/wiki/Getting-Started )
45
42
46
- ### Gradle
43
+ # Samples
47
44
48
- ` ` ` groovy
49
- repositories {
50
- maven {
51
- name = "KotlinBukkitAPI"
52
- url = "http://nexus.devsrsouza.com.br/repository/maven-public/"
53
- }
54
- }
45
+ KotlinBukkitAPI goes beyond this samples, and you can find all of it in the [ wiki/documentation] ( https://github.com/DevSrSouza/KotlinBukkitAPI/wiki/ ) .
55
46
56
- dependencies {
57
- compileOnly("br.com.devsrsouza.kotlinbukkitapi:core:0.1.0-SNAPSHOT") // core
58
- }
59
- ```
60
-
61
- # Examples
62
-
63
- Event DSL example
47
+ Event DSL sample
64
48
``` kotlin
65
49
plugin.events {
66
50
event<PlayerJoinEvent > {
@@ -76,7 +60,7 @@ plugin.events {
76
60
Simple Command DSL example
77
61
``` kotlin
78
62
plugin.simpleCommand(" twitter" ) {
79
- sender.msg(+ " &eFollow me on Twitter :D &ahttps://twitter.com/DevSrSouza" )
63
+ sender.msg(" &eFollow me on Twitter :D &ahttps://twitter.com/DevSrSouza" .translateColor() )
80
64
}
81
65
```
82
66
@@ -85,46 +69,56 @@ Item meta DSL and other stuff
85
69
val gem = item(Material .DIAMOND ).apply {
86
70
amount = 5
87
71
meta<ItemMeta > {
88
- displayName = + " &bGem"
72
+ displayName = " &bGem" .translateColor()
89
73
}
90
74
}
91
75
val encbook = item(Material .ENCHANTED_BOOK ).meta<EnchantmentStorageMeta > {
92
- displayName = + " &4&lThe powerful BOOK"
76
+ displayName = " &4&lThe powerful BOOK" .translateColor()
93
77
addStoredEnchant(Enchantment .DAMAGE_ALL , 10 , true ) // putting sharpness 10 to the book
94
78
}
95
79
```
96
80
81
+ Another approach:
82
+ ```
83
+ val gem = item(Material.DIAMOND, amount = 5).displayName("&bGem".translateColor())
84
+
85
+ val encbook = metadataItem<EnchantmentStorageMeta>(Material.ENCHANTED_BOOK) {
86
+ displayName = "&4&lThe powerful BOOK".translateColor()
87
+ addStoredEnchant(Enchantment.DAMAGE_ALL, 10, true) // putting sharpness 10 to the book
88
+ }
89
+ ```
90
+
97
91
Menu creator DSL
98
92
``` kotlin
99
93
val myMenu = menu(+ " &cWarps" , 3 , true ) {
100
94
101
- slot(2 , 4 ) { // Line, Slot
102
- item = ItemStack (Material .DIAMOND_SWORD ).apply {
103
- addEnchantment(Enchantment .DAMAGE_ALL , 5 )
104
-
105
- meta<ItemMeta > {
106
- displayName = + " &4Arena PvP"
107
- }
108
- }
95
+ val arenaPvP = item(Material .DIAMOND_SWORD ) {
96
+ addEnchant(Enchantment .DAMAGE_ALL , 5 , true )
97
+ displayName = " &4Arena PvP" .translateColor()
98
+ }
109
99
100
+ slot(2 , 4 , arenaPvP) { // Line, Slot
110
101
onClick {
111
102
player.teleport(Location (player.world, 250 , 70 , - 355 ))
112
103
close() // close the menu
113
104
}
114
105
}
115
106
116
- slot(2 , 6 ) {
117
- item = ItemStack (Material .GOLD ).apply {
118
- meta<ItemMeta > {
119
- displayName = + " &6Shop"
120
- }
121
- }
122
-
107
+ slot(2 , 6 , item(Material .GOLD ).displayName(" &6Shop" .translateColor())) {
123
108
onClick {
124
109
player.teleport(Location (player.world, 2399 , 70 , - 1234 ))
125
110
close() // close the menu
126
111
}
127
112
}
113
+
114
+ // when the menu renders to a player, will show the Paper item with their name.
115
+ slot(3 , 9 , item(Material .PAPER ).displayName(" Hello {player}" )) {
116
+ onRender {
117
+ showingItem?.meta<ItemMeta > {
118
+ displayName = displayName.replace(" {player}" , player.name)
119
+ }
120
+ }
121
+ }
128
122
}
129
123
130
124
// open to player
0 commit comments