Preparing
1. Java
Setup the JDK environment:
JDK 1.8.0_161
2. Eclipse IDE
Download Eclipse IDE
Eclipse Oxygen.3 (4.7.3)
3. Spigot Server API
Spigot Server API Doc
Spigot-API_1.12.2
Founded in 2012, SpigotMC.org is home to the community behind the biggest Minecraft server software projects and provides a place for everyone involved with Minecraft servers to connect with each other whether they seeking help and support or sharing and showcasing their work. We provide a web forum, chat room and wiki for providing support as well as project hosting for content creators and hope that you too will become involved in this extensive and growing community of more than 300,000 members.
Create a Maven Project
1. From Eclipse to create the Maven project


2. Use template to create Maven Project

3. Config the Maven Project

Group Id is the name of Java Package
Artifact Id is the name of Plugin run in MineCraft
Version is the software version
Packaging is the output type
4. Java Configuration in Maven Project
Add the code to pom.xml
<project>
......
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
1.8 is JDK version used in this project.
And then Update the Maven Project (Alt+F5)

Notice Please modified the JRE configuration to JDK
Add the Plugin Code
1. Add Spigot API Dependency Library
- Copy
spigot-api-1.11.2-R0.1-SNAPSHOT.jarto src/lib/ - Copy
spigot-api-1.11.2-R0.1-SNAPSHOT-shaded.jarto src/lib/ - Open the
pom.xml<project> ... <dependencies> <dependency> <groupId>org.bukkit</groupId> <artifactId>bukkit</artifactId> <version>1.11.2-R0.1</version> <scope>system</scope> <systemPath>${project.basedir}/src/lib/spigot-api-1.11.2-R0.1-SNAPSHOT.jar</systemPath> </dependency> <dependency> <groupId>org.bukkit.shared</groupId> <artifactId>bukkit_shared</artifactId> <version>1.11.2-R0.1</version> <scope>system</scope> <systemPath>${project.basedir}/src/lib/spigot-api-1.11.2-R0.1-SNAPSHOT-shaded.jar</systemPath> </dependency> </dependencies> </project>Tag Description groupIdThe domain of maven artifactIdThe union id of maven versionThe version of maven scopeThe scope of using maven systemPathThe path of dependency library spigot-api-1.11.2-R0.1-SNAPSHOT.jarandspigot-api-1.11.2-R0.1-SNAPSHOT-shaded.jarcan be got by compile the source code of Spigot
2. Create the Java files
- Right Click
src/main/javato create a package
Then add your package name - Create the Java main class
package com.github.yinquan.testplugin; import org.bukkit.plugin.java.JavaPlugin; public class PluginMain extends JavaPlugin { } - Create the
plugin.ymlThis file is needed when loading the plugin in Bukkit.
This file contains the basic information of plugin- Right click in
src/main/resourcesto chooseNew->File
- Add plugin information
name: {Plugin Name} main: {Package Name}.{Main Class Name} version: {Version Number}
- Right click in
- Add API doc to Eclipse ID
It is convenient to view the information of API that adding API to Eclipse ID- Choose the
Dependency LibraryinMaven Dependency

- Right click to choose
Properties, and then chooseJavadoc Location. Addhttps://jd.bukkit.org/

- Choose the
- Add
onEnable()andonDisable()methodpackage com.github.yinquan.testplugin; import org.bukkit.plugin.java.JavaPlugin; public class PluginMain extends JavaPlugin { @Override public void onEnable() { getLogger().info("onEnable has been invoked!"); } @Override public void onDisable() { getLogger().info("onDisable has been invoked!"): } }onEnableCalled when this plugin is enabledonDisableCalled when this plugin in disabledgetLooger().info(String msg)If the logger is currently enabled for the INFO message level the given message is forwarded to all the registered output Handler objects.
Build the Plugin Project
- In Eclipse, click
Run As->Maven install

- Finish Build, the Console will print the information

- The achieve file ({ProjectName}.jar) will be got.

Deploy the Plugin to MineCraft
- Copy the achieve file built by Eclipse to
pluginsfolder in Spigot Server Folder
- Run the Spigot Sever
When server start running, the text are printed in console of server
Check the loaded plugin:

