2018-03-06 18:24:13 -05:00
|
|
|
# Usage
|
2015-02-20 19:55:17 -05:00
|
|
|
Add this jar to your pom.xml to enable automatic annotation-based plugin.yml generation.
|
|
|
|
|
2018-03-06 18:24:13 -05:00
|
|
|
The only *required* annotation is the ```@Plugin``` annotation. All other annotations are optional.
|
|
|
|
See the [wiki](https://www.spigotmc.org/wiki/plugin-yml/) for more information.
|
|
|
|
|
2015-02-20 19:55:17 -05:00
|
|
|
## Example Usage
|
|
|
|
```
|
|
|
|
package org.spigotmc.annotationtest;
|
|
|
|
|
|
|
|
import org.bukkit.permissions.PermissionDefault;
|
|
|
|
import org.bukkit.plugin.PluginLoadOrder;
|
|
|
|
import org.bukkit.plugin.java.*;
|
|
|
|
import org.bukkit.plugin.java.annotation.*;
|
|
|
|
import org.bukkit.plugin.java.annotation.Commands.Cmd;
|
|
|
|
import org.bukkit.plugin.java.annotation.Permissions.Perm;
|
|
|
|
|
2018-03-06 18:24:13 -05:00
|
|
|
@Plugin(name = "TestPlugin", version = "1.0")
|
|
|
|
@Description(desc = "A test plugin")
|
|
|
|
@LoadOn(loadOn = PluginLoadOrder.POSTWORLD) // defaults to PluginLoadOrder.POSTWORLD if not preset
|
|
|
|
@Author(name = "md_5")
|
|
|
|
@Website(url = "spigotmc.org")
|
|
|
|
@LogPrefix(prefix = "Testing")
|
|
|
|
@Dependency(plugin = "WorldEdit")
|
|
|
|
@Dependency(plugin = "Towny")
|
|
|
|
@LoadBefore(plugin = "Essentials")
|
|
|
|
@SoftDependency(plugin = "FAWE")
|
|
|
|
@Command(name = "foo", desc = "Foo command", aliases = {"foobar", "fubar"}, permission = "test.foo", permissionMessage = "You do not have permission!", usage = "/<command> [test|stop]")
|
|
|
|
@Permission(name = "test.foo", desc = "Allows foo command", defaultValue = PermissionDefault.OP)
|
|
|
|
@Permission(name = "test.*", desc = "Wildcard permission", defaultValue = PermissionDefault.OP, children = {@ChildPermission(name ="test.foo")})
|
2015-02-20 19:55:17 -05:00
|
|
|
public class Test extends JavaPlugin {}
|
|
|
|
```
|
|
|
|
Output:
|
|
|
|
|
|
|
|
```
|
2018-03-06 18:24:13 -05:00
|
|
|
# Auto-generated plugin.yml, generated at 2018/03/06 18:15:44 by org.bukkit.plugin.java.annotation.PluginAnnotationProcessor
|
2015-02-20 19:55:17 -05:00
|
|
|
|
2018-03-06 18:24:13 -05:00
|
|
|
main: org.spigotmc.annotationtest.Test
|
|
|
|
name: TestPlugin
|
|
|
|
version: '1.0'
|
|
|
|
description: A test plugin
|
|
|
|
load: POSTWORLD
|
|
|
|
author: md_5
|
2015-02-20 19:55:17 -05:00
|
|
|
website: spigotmc.org
|
2018-03-06 18:24:13 -05:00
|
|
|
prefix: Testing
|
|
|
|
depend:
|
|
|
|
- WorldEdit
|
|
|
|
- Towny
|
|
|
|
softdepend:
|
|
|
|
- FAWE
|
|
|
|
loadbefore:
|
|
|
|
- Essentials
|
2015-02-20 19:55:17 -05:00
|
|
|
commands:
|
|
|
|
foo:
|
|
|
|
description: Foo command
|
2018-03-06 18:24:13 -05:00
|
|
|
aliases:
|
|
|
|
- foobar
|
|
|
|
- fubar
|
2015-02-20 19:55:17 -05:00
|
|
|
permission: test.foo
|
|
|
|
permission-message: You do not have permission!
|
2018-03-06 18:24:13 -05:00
|
|
|
usage: /<command> [test|stop]
|
2015-02-20 19:55:17 -05:00
|
|
|
permissions:
|
2018-03-06 18:24:13 -05:00
|
|
|
test.foo:
|
|
|
|
description: Allows foo command
|
|
|
|
default: op
|
2015-02-20 19:55:17 -05:00
|
|
|
test.*:
|
2018-03-06 18:24:13 -05:00
|
|
|
description: Wildcard permission
|
2015-02-20 19:55:17 -05:00
|
|
|
default: op
|
2018-03-06 18:24:13 -05:00
|
|
|
children:
|
|
|
|
test.foo: true
|
|
|
|
```
|