1- BukkitGradle [ ![ Build Status] ( https://img.shields.io/travis/EndlessCodeGroup/BukkitGradle.svg )] ( https://travis-ci.org/EndlessCodeGroup/BukkitGradle ) [ ![ license] ( https://img.shields.io/github/license/EndlessCodeGroup/BukkitGradle.svg )] ( https://github.com/EndlessCodeGroup/BukkitGradle/blob/master/LICENSE )
1+ BukkitGradle [ ![ Version ] ( https://img.shields.io/github/release/EndlessCodeGroup/BukkitGradle/all.svg?style=flat-square )] ( https://plugins.gradle.org/plugin/ru.endlesscode.bukkitgradle ) [ ![ Build Status] ( https://img.shields.io/travis/EndlessCodeGroup/BukkitGradle.svg?style=flat-square )] ( https://travis-ci.org/EndlessCodeGroup/BukkitGradle ) [ ![ license] ( https://img.shields.io/github/license/EndlessCodeGroup/BukkitGradle.svg?style=flat-square )] ( https://github.com/EndlessCodeGroup/BukkitGradle/blob/master/LICENSE )
22============
33Gradle utilities for easier writing Bukkit plugins.
44
@@ -7,30 +7,32 @@ 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+ - Sets archivesBaseName to plugin name
19+ - Supports APIs: Bukkit, CraftBukkit, Spigot, Paper
20+ - Provides short extension-functions to add common repositories and dependencies
1821- Generates plugin.yml from Gradle project information
1922- Allows to run dev server from IDE
23+ - Supports two cores for dev server: Spigot and Paper
24+ - Automatically downloads and updates BuildTools or Paperclip
2025- Automatically copies your plugin to plugins dir on server running
2126
2227#### TODO:
23- - Add extension function for PaperApi
24- - Add possibility to use Paper/CraftBukkit as dev server core
25- - Add automatically downloading of BuildTools
2628- Add smart dependency system
2729
2830## Apply plugin
2931[ BukkitGradle on plugins.gradle.org] ( https://plugins.gradle.org/plugin/ru.endlesscode.bukkitgradle )
3032#### With new plugins mechanism
3133``` groovy
3234plugins {
33- id "ru.endlesscode.bukkitgradle" version "0.7.1 "
35+ id "ru.endlesscode.bukkitgradle" version "0.8.0 "
3436}
3537```
3638
@@ -41,7 +43,7 @@ buildscript {
4143 jcenter()
4244 }
4345 dependencies {
44- classpath "gradle.plugin.ru.endlesscode:bukkit-gradle:0.7.1 "
46+ classpath "gradle.plugin.ru.endlesscode:bukkit-gradle:0.8.0 "
4547 }
4648}
4749
@@ -55,18 +57,24 @@ You can clone [this example project](https://github.com/EndlessCodeGroup/BukkitG
5557Simple ` build.gradle ` file that use BukkitGradle:
5658``` groovy
5759plugins {
58- id "ru.endlesscode.bukkitgradle" version "0.7.1 "
60+ id "ru.endlesscode.bukkitgradle" version "0.8.0 "
5961}
6062
6163// Project information
6264group "com.example"
6365description "My first Bukkit plugin with Gradle"
6466version "0.1"
6567
68+ // Wee need to add some repos
69+ repositories {
70+ spigot()
71+ // see section 'Repositories' for more info
72+ }
73+
6674// Let's add needed API to project
6775dependencies {
6876 compileOnly bukkit()
69- // You also can use craftbukkit(), spigot() and spigotApi()
77+ // see section 'Dependencies' for more info
7078}
7179```
7280` compileOnly ` - it's like provided scope in Maven. It means that this dependncy will not included to your final jar.
@@ -84,7 +92,7 @@ You can configure attributes that will be placed to `plugin.yml`:
8492` ` ` groovy
8593// Override default configurations
8694bukkit {
87- // Version of API (latest by default )
95+ // Version of API (if you will not set this property, will be used latest available )
8896 version = "1.12.2"
8997
9098 // Attributes for plugin.yml
@@ -112,17 +120,86 @@ authors: [OsipXD, Contributors]
112120Also you can add custom (unsupported by BukkitGradle) attributes like a `depend` etc.
113121Just create `plugin.yml` file and put custom attributes into.
114122
123+ # ### Quotes around values
124+ In some cases you may need put meta value in quotes. For this you can use `q` and `qq` functions.
125+
126+ For example we have meta :
127+ ` ` ` groovy
128+ meta {
129+ name = qq "Double Quoted Name"
130+ description = q "Single quoted description"
131+ url = "http://without.quot.es/"
132+ }
133+ ` ` `
134+
135+ And will be generated :
136+ ` ` ` yaml
137+ name: "Double Quoted Name"
138+ description: 'Single quoted description'
139+ website: http://without.quot.es/
140+ ` ` `
141+
142+ **Note:** In Groovy you can use functions in two ways: normal - `q("value")` and without braces - `q "value"`
143+
144+ # ## Repositories and Dependencies
145+ BukkitGradle provides short extension-functions to add common repositories and dependencies.
146+ There are list of its.
147+
148+ Usage example :
149+ ` ` ` groovy
150+ repositories {
151+ spigot() // Adds spigot repo
152+ }
153+
154+ dependencies {
155+ compileOnly paperApi() // Adds paper-api dependency
156+ }
157+ ` ` `
158+
159+ # #### Repositories:
160+ Name | Url
161+ ----------------|-------------------------------------------------------------------
162+ spigot | https://hub.spigotmc.org/nexus/content/repositories/snapshots/
163+ sk98q | http://maven.sk89q.com/repo/
164+ destroystokyo | https://repo.destroystokyo.com/repository/maven-public/
165+ dmulloy2 | http://repo.dmulloy2.net/nexus/repository/public/
166+ md5 | http://repo.md-5.net/content/groups/public/
167+ vault | http://nexus.hc.to/content/repositories/pub_releases/
168+ placeholderapi | http://repo.extendedclip.com/content/repositories/placeholderapi/
169+
170+ # #### Dependencies:
171+ Some dependencies also applies repo that needed for them.
172+
173+ Name | Signature | Applies repo
174+ -------------|-----------------------------------------------|---------------
175+ spigot | org.spigotmc:spigot:$apiVersion | -
176+ spigotApi | org.spigotmc:spigot-api:$apiVersion | spigot
177+ bukkit | org.bukkit:bukkit:$apiVersion | spigot
178+ craftbukkit | org.bukkit:craftbukkit:$apiVersion | -
179+ paperApi | com.destroystokyo.paper:paper-api:$apiVersion | destroystokyo
180+
181+ **Note:** `$apiVersion` - is `${version}-R0.1-SNAPSHOT` (where `$version` is `bukkit.version`)
182+
183+ If you want more extension-functions - you can [write issue](https://github.com/EndlessCodeGroup/BukkitGradle/issues/new).
184+
115185# ## Running Dev server
116- Before running server you should configure BuildTools and dev server location.
186+ Before running server you should configure dev server location.
117187
118- You can define it in `local.properties` file (that was automatically created in project root on refresh) :
188+ You can define it in `local.properties` file (that was automatically created in project directory on refresh) :
119189` ` ` properties
120- # Absolute path to directory that contains BuildTools.jar
121- buildtools.dir=/path/to/buildtools/
122190# Absolute path to dev server
123191server.dir=/path/to/buildtools/
124192` ` `
125- Or you can define it globally (for all projects that uses BukkitGradle) with environment variables `BUKKIT_DEV_SERVER_HOME`
193+
194+ If you use Spigot (see `bukkit.run.core`) you also should specify BuildTools location. For Paper no additional actions
195+ needed.
196+ ` ` ` properties
197+ # Absolute path to directory that contains BuildTools.jar
198+ buildtools.dir=/path/to/buildtools/
199+ ` ` `
200+ If there no BuildTools.jar it will be automatically downloaded.
201+
202+ **TIP:** you can define it globally (for all projects that uses BukkitGradle) with environment variables `BUKKIT_DEV_SERVER_HOME`
126203and `BUILDTOOLS_HOME`.
127204
128205# #### On IntelliJ IDEA
@@ -132,26 +209,28 @@ server configurations.
132209
133210
134211# #### On other IDEs
135- Run ' :startServer' task.
212+ Run ` :startServer` task.
136213
137214# ### Server run configurations
138215To accept EULA and change settings use `bukkit.run` section :
139216` ` ` groovy
140217bukkit {
141218 // INFO: Here used default values
142219 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 = ""
220+ // Core type. It can be 'spigot' or 'paper'
221+ core = "spigot"
222+ // Accept EULA
223+ eula = false
224+ // Set online-mode flag
225+ onlineMode = false
226+ // Debug mode (listen 5005 port, if you use running from IDEA this option will be ignored)
227+ debug = true
228+ // Set server encoding (flag -Dfile.encoding)
229+ encoding = "UTF-8"
230+ // JVM arguments
231+ javaArgs = "-Xmx1G"
232+ // Bukkit arguments
233+ bukkitArgs = ""
155234 }
156235}
157236` ` `
0 commit comments