plugin-yml/README.md

325 lines
9.0 KiB
Markdown
Raw Permalink Normal View History

2017-09-27 18:55:48 +00:00
# plugin-yml
2018-07-24 13:43:40 +00:00
[plugin-yml] is a simple Gradle plugin that generates the `plugin.yml` plugin description file for Bukkit plugins,
2018-07-24 13:51:06 +00:00
`bungee.yml` for Bungee plugins or `nukkit.yml` for Nukkit plugins based on the Gradle project. Various properties
are set automatically (e.g. project name, version or description) and additional properties can be added using a
simple DSL.
2017-09-27 18:55:48 +00:00
## Usage
2021-04-30 20:19:06 +00:00
[plugin-yml] requires at least **Gradle 5.0**. Using the latest version of Gradle is recommended.
2017-09-27 18:55:48 +00:00
### Default values
| Property | Value |
| ------------- | ------------- |
| Plugin name | Project name |
| Plugin version | Project version |
| Plugin description | Project description |
| Plugin URL (Bukkit only) | `url` project property |
| Plugin author | `author` project property |
2017-09-27 18:55:48 +00:00
### Bukkit
2018-07-24 13:51:06 +00:00
<details>
<summary><strong>Groovy</strong></summary>
2017-09-27 18:55:48 +00:00
```groovy
plugins {
2021-12-03 18:38:45 +00:00
id 'net.minecrell.plugin-yml.bukkit' version '0.5.1'
2017-09-27 18:55:48 +00:00
}
2021-07-16 13:52:00 +00:00
dependencies {
// Downloaded from Maven Central when the plugin is loaded
library 'com.google.code.gson:gson:2.8.7' // All platforms
bukkitLibrary 'com.google.code.gson:gson:2.8.7' // Bukkit only
}
2017-09-27 18:55:48 +00:00
bukkit {
// Default values can be overridden if needed
// name = 'TestPlugin'
// version = '1.0'
// description = 'This is a test plugin'
// website = 'https://example.com'
// author = 'Notch'
2017-09-27 18:55:48 +00:00
// Plugin main class (required)
main = 'com.example.testplugin.TestPlugin'
2018-07-24 12:09:46 +00:00
// API version (should be set for 1.13+)
apiVersion = '1.13'
2017-09-27 18:55:48 +00:00
// Other possible properties from plugin.yml (optional)
load = 'STARTUP' // or 'POSTWORLD'
authors = ['Notch', 'Notch2']
2017-09-27 18:55:48 +00:00
depend = ['WorldEdit']
softDepend = ['Essentials']
loadBefore = ['BrokenPlugin']
prefix = 'TEST'
defaultPermission = 'OP' // 'TRUE', 'FALSE', 'OP' or 'NOT_OP'
provides = ['TestPluginOldName', 'TestPlug']
2017-09-27 18:55:48 +00:00
commands {
test {
description = 'This is a test command!'
aliases = ['t']
permission = 'testplugin.test'
usage = 'Just run the command!'
// permissionMessage = 'You may not test this command!'
}
// ...
}
permissions {
'testplugin.*' {
2020-04-14 13:36:00 +00:00
children = ['testplugin.test'] // Defaults permissions to true
// You can also specify the values of the permissions
childrenMap = ['testplugin.test': false]
2017-09-27 18:55:48 +00:00
}
'testplugin.test' {
description = 'Allows you to run the test command'
setDefault('OP') // 'TRUE', 'FALSE', 'OP' or 'NOT_OP'
}
}
}
```
2018-07-24 13:51:06 +00:00
</details>
2017-09-27 18:55:48 +00:00
2018-07-24 13:51:06 +00:00
<details>
<summary><strong>kotlin-dsl</strong></summary>
2017-09-27 18:55:48 +00:00
```kotlin
plugins {
2021-12-03 18:38:45 +00:00
id("net.minecrell.plugin-yml.bukkit") version "0.5.1"
2017-09-27 18:55:48 +00:00
}
2021-07-16 13:52:00 +00:00
dependencies {
// Downloaded from Maven Central when the plugin is loaded
library(kotlin("stdlib")) // All platforms
library("com.google.code.gson", "gson", "2.8.7") // All platforms
bukkitLibrary("com.google.code.gson", "gson", "2.8.7") // Bukkit only
}
2017-09-27 18:55:48 +00:00
bukkit {
// Default values can be overridden if needed
// name = "TestPlugin"
// version = "1.0"
// description = "This is a test plugin"
// website = "https://example.com"
// author = "Notch"
2017-09-27 18:55:48 +00:00
// Plugin main class (required)
main = "com.example.testplugin.TestPlugin"
2018-07-24 12:09:46 +00:00
// API version (should be set for 1.13+)
apiVersion = "1.13"
2017-09-27 18:55:48 +00:00
// Other possible properties from plugin.yml (optional)
load = BukkitPluginDescription.PluginLoadOrder.STARTUP // or POSTWORLD
authors = listOf("Notch", "Notch2")
2017-09-27 18:55:48 +00:00
depend = listOf("WorldEdit")
softDepend = listOf("Essentials")
loadBefore = listOf("BrokenPlugin")
prefix = "TEST"
defaultPermission = BukkitPluginDescription.Permission.Default.OP // TRUE, FALSE, OP or NOT_OP
provides = listOf("TestPluginOldName", "TestPlug")
2017-09-27 18:55:48 +00:00
commands {
register("test") {
2017-09-27 18:55:48 +00:00
description = "This is a test command!"
aliases = listOf("t")
permission = "testplugin.test"
usage = "Just run the command!"
// permissionMessage = "You may not test this command!"
}
// ...
}
permissions {
register("testplugin.*") {
2020-04-14 13:36:00 +00:00
children = listOf("testplugin.test") // Defaults permissions to true
// You can also specify the values of the permissions
childrenMap = mapOf("testplugin.test" to true)
2017-09-27 18:55:48 +00:00
}
register("testplugin.test") {
2017-09-27 18:55:48 +00:00
description = "Allows you to run the test command"
default = BukkitPluginDescription.Permission.Default.OP // TRUE, FALSE, OP or NOT_OP
}
}
}
```
2018-07-24 13:51:06 +00:00
</details>
2017-09-27 18:55:48 +00:00
### BungeeCord
2017-09-27 18:55:48 +00:00
2018-07-24 13:51:06 +00:00
<details>
<summary><strong>Groovy</strong></summary>
2017-09-27 18:55:48 +00:00
```groovy
plugins {
2021-12-03 18:38:45 +00:00
id 'net.minecrell.plugin-yml.bungee' version '0.5.1'
2017-09-27 18:55:48 +00:00
}
2021-07-16 13:52:00 +00:00
dependencies {
// Downloaded from Maven Central when the plugin is loaded
library 'com.google.code.gson:gson:2.8.7' // All platforms
bungeeLibrary 'com.google.code.gson:gson:2.8.7' // Bungee only
}
2017-09-27 18:55:48 +00:00
bungee {
// Default values can be overridden if needed
// name = 'TestPlugin'
// version = '1.0'
// description = 'This is a test plugin'
// Plugin main class (required)
main = 'com.example.testplugin.TestPlugin'
// Other possible properties from bungee.yml
author = 'Notch'
depends = ['Yamler']
softDepends = ['ServerListPlus']
}
```
2018-07-24 13:51:06 +00:00
</details>
2017-09-27 18:55:48 +00:00
2018-07-24 13:51:06 +00:00
<details>
<summary><strong>kotlin-dsl</strong></summary>
2017-09-27 18:55:48 +00:00
```kotlin
plugins {
2021-12-03 18:38:45 +00:00
id("net.minecrell.plugin-yml.bungee") version "0.5.1"
2017-09-27 18:55:48 +00:00
}
2021-07-16 13:52:00 +00:00
dependencies {
// Downloaded from Maven Central when the plugin is loaded
library(kotlin("stdlib")) // All platforms
library("com.google.code.gson", "gson", "2.8.7") // All platforms
bungeeLibrary("com.google.code.gson", "gson", "2.8.7") // Bungee only
}
2017-09-27 18:55:48 +00:00
bungee {
// Default values can be overridden if needed
// name = "TestPlugin"
// version = "1.0"
// description = "This is a test plugin"
// Plugin main class (required)
main = "com.example.testplugin.TestPlugin"
// Other possible properties from bungee.yml
author = "Notch"
depends = setOf("Yamler")
softDepends = setOf("ServerListPlus")
}
```
2018-07-24 13:51:06 +00:00
</details>
2017-09-27 18:55:48 +00:00
2018-07-24 13:43:40 +00:00
### Nukkit
2018-07-24 13:51:06 +00:00
<details>
<summary><strong>Groovy</strong></summary>
2018-07-24 13:43:40 +00:00
```groovy
plugins {
2021-12-03 18:38:45 +00:00
id 'net.minecrell.plugin-yml.nukkit' version '0.5.1'
2018-07-24 13:43:40 +00:00
}
2018-07-24 13:55:13 +00:00
nukkit {
2018-07-24 13:43:40 +00:00
// Default values can be overridden if needed
// name = 'TestPlugin'
// version = '1.0'
// description = 'This is a test plugin'
// website = 'https://example.com'
// author = 'Notch'
// Plugin main class and api (required)
main = 'com.example.testplugin.TestPlugin'
api = ['1.0.0']
// Other possible properties from nukkit.yml (optional)
load = 'STARTUP' // or 'POSTWORLD'
authors = ['Notch', 'Notch2']
depend = ['PlotSquared']
softDepend = ['LuckPerms']
loadBefore = ['BrokenPlugin']
prefix = 'TEST'
commands {
test {
description = 'This is a test command!'
aliases = ['t']
permission = 'testplugin.test'
usage = 'Just run the command!'
}
// ...
}
permissions {
'testplugin.*' {
2018-07-24 13:55:13 +00:00
description = 'Allows you to run all testplugin commands'
children {
'testplugin.test' {
description = 'Allows you to run the test command'
setDefault('OP') // 'TRUE', 'FALSE', 'OP' or 'NOT_OP'
}
}
2018-07-24 13:43:40 +00:00
}
}
}
```
2018-07-24 13:51:06 +00:00
</details>
2018-07-24 13:43:40 +00:00
2018-07-24 13:51:06 +00:00
<details>
<summary><strong>kotlin-dsl</strong></summary>
2018-07-24 13:43:40 +00:00
```kotlin
plugins {
2021-12-03 18:38:45 +00:00
id("net.minecrell.plugin-yml.nukkit") version "0.5.1"
2018-07-24 13:43:40 +00:00
}
2018-07-24 13:55:13 +00:00
nukkit {
2018-07-24 13:43:40 +00:00
// Default values can be overridden if needed
// name = "TestPlugin"
// version = "1.0"
// description = "This is a test plugin"
// website = "https://example.com"
// author = "Notch"
// Plugin main class and api (required)
main = "com.example.testplugin.TestPlugin"
api = listOf("1.0.0")
// Other possible properties from nukkit.yml (optional)
load = NukkitPluginDescription.PluginLoadOrder.STARTUP // or POSTWORLD
authors = listOf("Notch", "Notch2")
depend = listOf("PlotSquared")
softDepend = listOf("LuckPerms")
loadBefore = listOf("BrokenPlugin")
prefix = "TEST"
commands {
register("test") {
2018-07-24 13:43:40 +00:00
description = "This is a test command!"
aliases = listOf("t")
permission = "testplugin.test"
usage = "Just run the command!"
}
// ...
}
permissions {
register("testplugin.*") {
2018-07-24 13:55:13 +00:00
description = "Allows you to run all testplugin commands"
children {
register("testplugin.test") {
2018-07-24 13:55:13 +00:00
description = "Allows you to run the test command"
default = NukkitPluginDescription.Permission.Default.OP // TRUE, FALSE, OP or NOT_OP
}
}
2018-07-24 13:43:40 +00:00
}
}
}
```
2018-07-24 13:51:06 +00:00
</details>
2018-07-24 13:43:40 +00:00
2017-09-27 18:55:48 +00:00
[plugin-yml]: https://github.com/Minecrell/plugin-yml