You can use this template to develop your own high quality Spigot plugins using Gradle with ease.
See the minecraft-server-template for quick starting your Minecraft network in under 30 seconds.
The template or better boilerplate comes with a lot of features that are useful if you want to develop high quality plugins. However you don't need to use all of them, you can simply remove the features you don't need.
plugin.yaml
based of project properties with SpiGradleno more need for self hosted nexus or artifactory server
group
: your-maven-group-id (e.g.: io.github.silthus)pluginName
: YourPluginNameauthor
: YourNameroot.projectName
inside settings.gradle. This will be your artifactId
.CHANGELOG.md
. It will be generated on your first release.README
to point to your project and spigot resource id.prepareSpigotPlugins
gradle task this will try to download all plugin denpendencies and puts them into debug/spigot/plugins/
.debugPaper
task. This will start the server in the background and you can connect to it using the localhost:25565
address.Please read the Contributing Guidelines before submitting any pull requests or opening issues.
NOTE
You might need to run thegradle clean
task after renaming the packages and reimport the gradle project to resolve errors with generating theplugin.yml
.
One of the major benefits of this template is the fact that it will automatically release a new version on every push to master
based on your commit messages. This makes sure your plugin is released following the semantic versioning guidelines. For this to work you have to follow a few simple rules:
See the conventional commit homepage for more details and examples on the topic. But here is a quick summary to get you started.
The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.
The commit message should be structured as follows:
[optional scope]:
[optional body]
[optional footer(s)]
The commit contains the following structural elements, to communicate intent to the consumers of your library or plugin:
fix:
a commit of the type fix patches a bug in your codebase (this correlates with PATCH in semantic versioning).feat:
a commit of the type feat introduces a new feature to the codebase (this correlates with MINOR in semantic versioning).BREAKING CHANGE:
a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in semantic versioning). A BREAKING CHANGE can be part of commits of any type.build:
, chore:
, ci:
, docs:
, style:
, refactor:
, perf:
, test:
, and others.BREAKING CHANGE:
may be provided and follow a convention similar to git trailer format.
Additional types are not mandated by the Conventional Commits specification, and have no implicit effect in semantic versioning (unless they include a BREAKING CHANGE).A scope may be provided to a commit’s type, to provide additional contextual information and is contained within parenthesis, e.g., feat(parser): add ability to parse arrays
.
Here are some examples:
feat: allow provided config object to extend other configs
BREAKING CHANGE: `extends` key in config file is now used for extending other config files
docs: correct spelling of CHANGELOG
feat(lang): add polish language
fix: correct minor typos in code
see the issue for details
on typos fixed.
Reviewed-by: Z
Refs #133
Your plugin will be automatically published as a maven package on Github packages as soon as you release a new version.
The group
appended by your artifactId
is used to uniquely identify your project when importing it in other projects. When you import spigot in your project you use the group org.spigotmc
followed by the artifactId spigot-api
and the version.
The following was taken from the offical maven naming guide.
groupId
uniquely identifies your project across all projects. A group ID should follow Java's package name rules. This means it starts with a reversed domain name you control. For example: org.apache.maven
, org.apache.commons
.io.github
appended by your Github username, e.g. io.github.silthus
artifactId
is the name of the jar without version. If you created it, then you can choose whatever name you want with lowercase letters and no strange symbols. For example: `maven, commons-mathYou need to configure authentication for Github Packages if you want to use your maven package in other projects.
gradle.properties
inside C:Users%username%.gradle
with the following and replace YOUR_GITHUB_USERNAME
with your Github username and YOUR_PERSONAL_ACCESS_TOKEN
with the access token from step 1.gpr.user=YOUR_GITHUB_USERNAME
gpr.key=YOUR_PERSONAL_ACCESS_TOKEN
You can export your plugin to the plugins directory from your working directory with the Gradle prepareSpigotPlugins task. The task will build and copy your plugin automatically into the plugins/
directory.
You can run or debug your plugin using the Server
run configuration from within IntelliJ to automatically download the Minecraft server, built it, copy your and dependent plugins into it and start it in debugging mode.
This is due to the awesome power of Spigradle's debug tasks. Find out more on the Spigradle Github page.