项目作者: HexagonMC

项目描述 :
Gradle plugin for Spigot- and BungeeCord-Plugins
高级语言: Java
项目地址: git://github.com/HexagonMC/Spigot-Gradle.git
创建时间: 2017-06-16T16:31:28Z
项目社区:https://github.com/HexagonMC/Spigot-Gradle

开源协议:GNU General Public License v3.0

下载


Spigot-Gradle

Gradle plugin for Spigot- and BungeeCord-Plugins

Build Status
Download
codecov
Maven Central

This plugin automatically generates the plugin.yml and bungee.yml for you gradle project.

The project is hosted on jCenter and Maven Central.

Usage

To use it simply add the plugin to your project as described below.
After this your project values like name, version, description and ext.url or ext.website are inherited by the plugin.yml and bungee.yml. You can also specify the configuration blocks spigot and bungee inside your build script to overwrite the default values.

Any other values can be defined in the resource files plugin.yml and bungee.yml (in src/main/resources) like before or in the configuration blocks.

The main class can be defined in the resource files, the configuration block or via Spigot-Annotations

Properties defined via annotation will override config and resource properties. Config properties will overwrite resource properties.

For example:

Spigot

  1. spigot {
  2. main "eu.hexagonmc.Main"
  3. name "TestPlugin"
  4. version "1.0.0-SNAPSHOT"
  5. description "A test plugin"
  6. author "Zartec"
  7. author "ghac"
  8. load "STARTUP"
  9. website "https://hexagonmc.eu/"
  10. database false
  11. prefix "TP-Logger"
  12. dependencies {
  13. Vault
  14. Vault {
  15. type "DEPEND"
  16. }
  17. Vault {
  18. type "SOFTDEPEND"
  19. }
  20. Vault {
  21. type "LOADBEFORE"
  22. }
  23. }
  24. dependency "Vault"
  25. dependency "Vault", "SOFTDEPEND"
  26. dependency("Vault") {
  27. type "LOADBEFORE"
  28. }
  29. commands {
  30. test1
  31. test2 {
  32. description "A test command"
  33. alias "test2.1"
  34. alias "test2.2"
  35. permission "command.test2"
  36. usage "/<command>"
  37. }
  38. }
  39. command "test3"
  40. command("test4") {
  41. description "A test command"
  42. alias "test4.1"
  43. alias "test4.2"
  44. permission "command.test4"
  45. usage "/<command>"
  46. }
  47. permissions {
  48. "command.test1" {}
  49. "command.test2" {
  50. description "A test permission"
  51. value "OP"
  52. childs {
  53. "command.test2.1"
  54. "command.test2.2" {
  55. value false
  56. }
  57. }
  58. child "command.test2.3"
  59. child "command.test2.4", false
  60. child("command.test2.5") {
  61. value false
  62. }
  63. }
  64. }
  65. permission "command.test3"
  66. permission("command.test4") {
  67. description "A test permission"
  68. value "OP"
  69. childs {
  70. "command.test4.1"
  71. "command.test4.2" {
  72. value false
  73. }
  74. }
  75. child "command.test4.3"
  76. child "command.test4.4", false
  77. child("command.test4.5") {
  78. value false
  79. }
  80. }
  81. }

BungeeCord

  1. bungee {
  2. main "eu.hexagonmc.Main"
  3. name "TestPlugin"
  4. version "1.0.0-SNAPSHOT"
  5. description "A test plugin"
  6. author "Zartec" // Only one author possible
  7. dependencies {
  8. Vault
  9. Vault {
  10. type "DEPEND"
  11. }
  12. Vault {
  13. type "SOFTDEPEND"
  14. }
  15. Vault {
  16. type "LOADBEFORE"
  17. }
  18. }
  19. dependency "Vault"
  20. dependency "Vault", "SOFTDEPEND"
  21. dependency("Vault") {
  22. type "LOADBEFORE"
  23. }
  24. }

Via buildscript block

Add the buildscript part to your build.gradle.

  1. ...
  2. buildscript {
  3. ...
  4. repositories {
  5. maven {
  6. url "https://plugins.gradle.org/m2/"
  7. }
  8. or
  9. jCenter()
  10. or
  11. mavenCentral()
  12. }
  13. ...
  14. dependencies {
  15. classpath group: 'eu.hexagonmc', name: 'spigot-gradle', version: '1.3'
  16. }
  17. }
  18. ...

Apply the plugin in your build.gradle.

  1. ...
  2. apply plugin: "eu.hexagonmc.gradle.spigot"
  3. ...

Via plugins block

Apply the plugin in your build.gradle.

  1. ...
  2. plugins {
  3. id "eu.hexagonmc.gradle.spigot" version "1.3"
  4. }
  5. ...