@@ -7,14 +7,15 @@ Gradle utilities for easier writing Bukkit plugins.
772 . [ Usage] ( #usage )
88 1 . [ First steps] ( #first-steps )
99 2 . [ Configuring plugin] ( #configuring-plugin )
10- 3 . [ Running Dev server] ( #running-dev-server )
10+ 1 . [ Quotes around values] ( #quotes-around-values )
11+ 3 . [ Repositories and Dependencies] ( #repositories-and-dependencies )
12+ 4 . [ Running Dev server] ( #running-dev-server )
1113 1 . [ Server run configurations] ( #server-run-configurations )
1214
1315#### Features:
1416- Automatically applies plugins: java, idea, eclipse
1517- Sets up compiler encoding to UTF-8
16- - Adds repositories: mavenCentral, mavenLocal, spigot-repo, sk89q-repo
17- - Provides short extension-functions to include bukkit/craftbukkit/spigot/spigot-api
18+ - Provides short extension-functions to add common repositories and dependencies
1819- Generates plugin.yml from Gradle project information
1920- Allows to run dev server from IDE
2021- Automatically copies your plugin to plugins dir on server running
@@ -63,10 +64,16 @@ group "com.example"
6364description "My first Bukkit plugin with Gradle"
6465version "0.1"
6566
67+ // Wee need to add some repos
68+ repositories {
69+ spigot()
70+ // see section 'Repositories' for more info
71+ }
72+
6673// Let's add needed API to project
6774dependencies {
6875 compileOnly bukkit()
69- // You also can use craftbukkit(), spigot() and spigotApi()
76+ // see section 'Dependencies' for more info
7077}
7178```
7279` compileOnly ` - it's like provided scope in Maven. It means that this dependncy will not included to your final jar.
@@ -84,7 +91,7 @@ You can configure attributes that will be placed to `plugin.yml`:
8491` ` ` groovy
8592// Override default configurations
8693bukkit {
87- // Version of API (latest by default )
94+ // Version of API (if you will not set this property, will be used latest available )
8895 version = "1.12.2"
8996
9097 // Attributes for plugin.yml
@@ -112,17 +119,83 @@ authors: [OsipXD, Contributors]
112119Also you can add custom (unsupported by BukkitGradle) attributes like a `depend` etc.
113120Just create `plugin.yml` file and put custom attributes into.
114121
122+ # ### Quotes around values
123+ In some cases you may need put meta value in quotes. For this you can use `q` and `qq` functions.
124+
125+ For example we have meta :
126+ ` ` ` groovy
127+ meta {
128+ name = qq "Double Quoted Name"
129+ description = q "Single quoted description"
130+ url = "http://without.quot.es/"
131+ }
132+ ` ` `
133+
134+ And will be generated :
135+ ` ` ` yaml
136+ name: "Double Quoted Name"
137+ description: 'Single quoted description'
138+ website: http://without.quot.es/
139+ ` ` `
140+
141+ **Note:** In Groovy you can use functions in two ways: normal - `q("value")` and without braces - `q "value"`
142+
143+ # ## Repositories and Dependencies
144+ BukkitGradle provides short extension-functions to add common repositories and dependencies.
145+ There are list of its.
146+
147+ Usage example :
148+ ` ` ` groovy
149+ repositories {
150+ spigot() // Adds spigot repo
151+ }
152+
153+ dependencies {
154+ compileOnly paperApi() // Adds paper-api dependency
155+ }
156+ ` ` `
157+
158+ # #### Repositories:
159+ Name | Url
160+ ----------------|----------------------------------------------------------------
161+ spigot | https://hub.spigotmc.org/nexus/content/repositories/snapshots/
162+ sk98q | http://maven.sk89q.com/repo/
163+ destroystokyo | https://repo.destroystokyo.com/repository/maven-public/
164+ dmulloy2 | http://repo.dmulloy2.net/nexus/repository/public/
165+ md5 | http://repo.md-5.net/content/groups/public/
166+ vault | http://nexus.hc.to/content/repositories/pub_releases/
167+ placeholderapi | http://repo.extendedclip.com/content/repositories/placeholderapi/
168+
169+ # #### Dependencies:
170+ Name | Signature
171+ -------------|-----------------------------------------------
172+ spigot | org.spigotmc:spigot:$apiVersion
173+ spigotApi | org.spigotmc:spigot-api:$apiVersion
174+ bukkit | org.bukkit:bukkit:$apiVersion
175+ craftbukkit | org.bukkit:craftbukkit:$apiVersion
176+ paperApi | com.destroystokyo.paper:paper-api:$apiVersion
177+
178+ **Note:** `$apiVersion` - is `${version}-R0.1-SNAPSHOT` (where `$version` is `bukkit.version`)
179+
180+
115181# ## Running Dev server
116- Before running server you should configure BuildTools and dev server location.
182+ Before running server you should configure dev server location.
117183
118- You can define it in `local.properties` file (that was automatically created in project root on refresh) :
184+ You can define it in `local.properties` file (that was automatically created in project directory on refresh) :
119185` ` ` properties
120- # Absolute path to directory that contains BuildTools.jar
121- buildtools.dir=/path/to/buildtools/
122186# Absolute path to dev server
123187server.dir=/path/to/buildtools/
124188` ` `
125- Or you can define it globally (for all projects that uses BukkitGradle) with environment variables `BUKKIT_DEV_SERVER_HOME`
189+
190+ If you use Spigot (see `bukkit.run.core`) you also should specify BuildTools location. For Paper no additional actions
191+ needed.
192+ ` ` ` properties
193+ # Absolute path to directory that contains BuildTools.jar
194+ buildtools.dir=/path/to/buildtools/
195+ ` ` `
196+ If there no BuildTools.jar it will be automatically downloaded.
197+
198+ **TIP:** you can define it globally (for all projects that uses BukkitGradle) with environment variables `BUKKIT_DEV_SERVER_HOME`
126199and `BUILDTOOLS_HOME`.
127200
128201# #### On IntelliJ IDEA
@@ -132,26 +205,28 @@ server configurations.
132205
133206
134207# #### On other IDEs
135- Run ' :startServer' task.
208+ Run ` :startServer` task.
136209
137210# ### Server run configurations
138211To accept EULA and change settings use `bukkit.run` section :
139212` ` ` groovy
140213bukkit {
141214 // INFO: Here used default values
142215 run {
143- // Accept EULA
144- eula = false
145- // Set online-mode flag
146- onlineMode = false
147- // Debug mode (listen 5005 port, if you use running from IDEA this option will be ignored)
148- debug = true
149- // Set server encoding (flag -Dfile.encoding)
150- encoding = "UTF-8"
151- // JVM arguments
152- javaArgs = "-Xmx1G"
153- // Bukkit arguments
154- bukkitArgs = ""
216+ // Core type. It can be 'spigot' or 'paper'
217+ core = "spigot"
218+ // Accept EULA
219+ eula = false
220+ // Set online-mode flag
221+ onlineMode = false
222+ // Debug mode (listen 5005 port, if you use running from IDEA this option will be ignored)
223+ debug = true
224+ // Set server encoding (flag -Dfile.encoding)
225+ encoding = "UTF-8"
226+ // JVM arguments
227+ javaArgs = "-Xmx1G"
228+ // Bukkit arguments
229+ bukkitArgs = ""
155230 }
156231}
157232` ` `
0 commit comments