Nukkit Plugin Annotations is now available
Plugin Annotations is a tool created to help developers who find it tedious to make and fill out a plugin.yml
file every time they create a new project.
Example: (full)
1 |
|
Output:
1 |
|
Getting Started
Prerequisites
The only prerequisite to using plugin-annotations is to have it as a dependency. If you are using maven this is the same process as adding any other dependency.
1 |
|
It uses the JitPack repository.
1 |
|
If you are using gradle then simple add this to your dependencies block:
1 |
|
1 |
|
These annotations are not required to be in any sort of order, any order depicted here is simply for illustrative purposes.
Required Annotations
Plugin-annotations only has one required annotation! The @Plugin annotation.
If you are familiar with how plugin.yml files work then you probably know that the only required attributes are the main, name, version, and api attributes. All other attributes are, while helpful, optional. The @Plugin annotation satisfies all three of those requirements in a single annotation.
@Plugin
There are two values that are required within the @Plugin annotation. They are name, and version.
The name attributes defines the name of the plugin and the version attribute defines the version of the plugin.
For more information on these attributes see the Javadoc.
1 |
|
Optional Annotations
@Description
Defines the human-friendly description for the plugin.
1 |
|
@LoadOn
Defines the load order of the plugin. (Defaults to PluginLoadOrder.POSTWORLD)
1 |
|
@Author
Defines the author of this plugin.
This annotation is repeatable.
1 |
|
@Website
This annotation defines the website for this plugin.
1 |
|
@LogPrefix
This annotation defines the prefix used for the plugin’s log entries instead of the plugin’s name.
1 |
|
@Dependency
This annotation defines another plugin that is required for this plugin to load.
Use the required plugin’s name attribute to specify a dependency.
This annotation is repeatable.
1 |
|
@LoadBefore
Defines a plugin that this plugin should load before.
This is equivalent to the other plugin soft-depending on this plugin.
This annotation is repeatable.
1 |
|
@SoftDependency
Defines a plugin that is required for this plugin to have full functionality.
This annotation is repeatable.
1 |
|
@Command
Defines a new command for this plugin.
This annotation is repeatable.
1 |
|
@Permission
Defines a new permission for this plugin.
This annotation is repeatable.
1 |
|
@ChildPermission
Defines a new child permission. This annotation is only used in the @Permission annotation.
1 |
|
All these annotations have the same options as their plugin.yml counterparts.
Appendix
Plugin-Annotations uses java 8’s repeatable annotation. The follow annotations are repeatable, and their parents follow.
@Author -> @Authors
@Dependency -> @DependsOn
@LoadBefore -> @LoadBeforePlugins
@SoftDependency -> @SoftDependsOn
@Command -> @Commands
@Permission -> @Permissions
It is highly recommended to simply repeat the usage of a repeatable annotation instead of using it’s parent to register multiple of the same annotation.