This repository provides a template for creating a Minecraft plugin using the Spigot API (and compatible with Paper). It includes a basic outline of the file structure, a template README file, and other helpful resources.
1. Features
-
- Contains basic Minecraft plugin repository structure
plugin.yml
file andconfig.yml
file- Compatible with both Spigot and Paper
-
- Excludes many different files related to Minecraft plugin development
- Support for IntelliJ IDEA, NetBeans, Eclipse, and VS Code
- Excludes Maven files
-
- Five customizable sections:
- Features
- Commands
- Config
- Contribution
- License
- All you need to do is update the placeholder text with your plugin's information
- Five customizable sections:
On the main page of this repository, click Use this template
which is located above the list of files.
Then select Create a new repository
.
Use the owner dropdown to select which account you want to own the repository.
Give your repository a name.
If you'd like, you can also include a description.
While you can change your package name in your IDE, you can also do it in GitHub using their web editor. Below are the steps you can take to change your package name on GitHub before you clone the repository.
Navigate to the src/main
file in your new repository.
Change the github.com
in your URL to github.dev
to open up the web editor.
In the editor, navigate to src/main --> java
.
You should now be in java/io/atlaska826/templateplugin
. Rename your package by right-clicking on each part of the package and selecting rename. You cannot use capitals in your package name.
Example: java/io/atlaska826/templateplugin
--> java/com/yourname/pluginname
.
Remember to also change your package in the TemplatePlugin.java file and the plugin.yml!
Before you begin, you'll want to navigate to the directory you want to make your repository in. In the IDE of your choosing, open the terminal, and use the cd
command to get to the directory you want to create your project folder in. You can also use the built-in terminal on your computer to complete this step.
For example if you store all your projects in a folder called IntelliJ Projects
, then you would want to navigate to that folder.
Start about by cloning your newly made repository to your local device. In whatever terminal you have open, type the following command:
git clone <your-repository-url>
If you did not use the terminal in your IDE, you will now want to open your project in the IDE of your choosing.
At certain times, I've found that doing this step can cause issues for those who wish to utilize Maven in their project. I would recommend completing the steps to add support for Maven to your project prior to completing this next part.
Once you have cloned your repository on your local device, you will need to connect your project to your repository on GitHub so that you can push changes to it. In your IDE's terminal, make sure you are in the root directory of your project and then type in the following command:
git remote add origin <your-repository-url>
You can verify that the remote has been added by typing in the following command:
git remote -v
This section will detail Maven Setup for IntelliJ only since it is the IDE I usually use and am familiar with.
With your project open, right-click on the project folder in your project tool window (the thing on the left side of your screen). In the dropdown, find the button labeled Add Framework Support...
and click it.
In the window that pops up, select the checkbox labeled Maven
. Then click OK
. IntelliJ will generate the default Maven layout as well as a pom.xml
file.
Since the Spigot API works fine on Paper servers, this tutorial will focus on building with Spigot. If you would like to develop with the Paper API, please see this link.
In the newly created pom.xml
file, you will need to specify a groupId
. I would recommend your groupId
be the same as your package name. For example, the groupId
for this template plugin would be io.atlaska826
.
Under the <version>
tags in your pom.xml
file, you'll want to add the following code:
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
You can always change you API version to fit whatever your needs are. If you do change you API version to be something other than 1.19, make sure you update the api-version
in your plugin.yml
file.
Load your Maven changes by clicking the Maven icon that appears on the right side of the editing window (pictured below).
On the right side of your IntelliJ window, you should see a tab labeled Maven
. Click on it.
Use the dropdown arrows next to your plugin's name in the Maven tab and expand the Lifecycle
tree.
In the Lifecycle
tree, double-click the button labeled package
. Your plugin will now be compiled in a folder named target
under your project root.
If you would like to specify your .jar
file's name and output directory, add the following code about the <repositories>
tag in your pom.xml
file:
<build>
<finalName>TemplatePlugin</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<outputDirectory>/Path/To/Preferred/Directory</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
You can change the value in the <finalName>
tags to change your .jar
file's name. The directory should be pretty self-explanatory.
- Copy the text below
- Paste it into your project's
README.md
file - Edit the information as needed
# Plugin Name Here
Plugin description here.
## ⭐ Features ⭐
### Feature 1
* Description
### Feature 2
* Description
### Feature 3
* Description
## ⌨️ Commands ⌨️
### `commandOne-name`:
* Function:
* Permission:
### `commandTwo-name`:
* Function:
* Permission:
### `commandThree-name`:
* Function:
* Permission:
## ⚙️ Config ⚙️
Insert information for plugin configuration here.
## 📥 Contribution 📥
Insert information on how to contribute to your plugin here.
## 📝 License 📝
Insert license information here.
While this template repository is licensed under the MIT license, both the Spigot and Paper APIs are licensed under the GNU General Public License v3.0 license. As such, your plugin may need to be licensed under the GPL v3.0 license. However, that is not always the case. For more information about each APIs licensing, please see the links below.
Link to Spigot License
Link to Paper License
Copyright © 2024 Atlas Mallams
This repository is licensed under the MIT License.
For more information, please see LICENSE.