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 a template to create a Maven Project
3. Configure the Maven Project
“Group Id” is the name of a Java Package “Artifact Id” is the name of the Plugin run in Minecraft “Version” is the software version “Packaging” is the output type
This file is needed when loading the plugin in Bukkit. This file contains the basic information about the plugin.
Right-click in src/main/resources to choose New → File
Add plugin information:
JSON
name: {Plugin Name}main: {Package Name}.{Main Class Name}version: {Version Number}
Add API doc to the Eclipse IDE
It is convenient to view the API information when adding the API to the Eclipse IDE.
Choose the Dependency Library in Maven Dependency
Right-click to choose Properties, and then choose Javadoc Location. Add https://jd.bukkit.org/
Add onEnable() and onDisable() method
Java
packagecom.github.yinquan.testplugin;importorg.bukkit.plugin.java.JavaPlugin;publicclassPluginMainextendsJavaPlugin{@OverridepublicvoidonEnable(){getLogger().info("onEnable has been invoked!");}@OverridepublicvoidonDisable(){getLogger().info("onDisable has been invoked!");}}
onEnable — Called when this plugin is enabled
onDisable — Called when this plugin is disabled
getLogger().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 building, and the Console will print the information
The archive file ({ProjectName}.jar) will be obtained.
Deploy the Plugin to Minecraft
Copy the archive file built by Eclipse to plugins folder in Spigot Server Folder
Run the Spigot Server
When the server starts running, the text is printed in cthe onsole of the server: