I. How to build up a MineCraft Plugin


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

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


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.jar to src/lib/
  • Copy spigot-api-1.11.2-R0.1-SNAPSHOT-shaded.jar to src/lib/
  • Open the pom.xml
    Tag Description
    groupId The domain of maven
    artifactId The union id of maven
    version The version of maven
    scope The scope of using maven
    systemPath The path of dependency library

    spigot-api-1.11.2-R0.1-SNAPSHOT.jar and spigot-api-1.11.2-R0.1-SNAPSHOT-shaded.jar can be got by compile the source code of Spigot

2. Create the Java files

  • Right Click src/main/java to create a package
    Eclipse008Then 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/resources to choose New -> FileEclipse009
    • Add plugin information
      name: {Plugin Name}
      main: {Package Name}.{Main Class Name}
      version: {Version Number}
  • Add API doc to Eclipse ID
    It is convenient to view the information of API that adding API to Eclipse ID
    • 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
    package com.github.yinquan.testplugin;
    import org.bukkit.plugin.java.JavaPlugin;
    public class PluginMain extends JavaPlugin {
        public void onEnable() {
            getLogger().info("onEnable has been invoked!");
        public void onDisable() {
            getLogger().info("onDisable has been invoked!"):
    • onEnableCalled when this plugin is enabled
    • onDisableCalled when this plugin in disabled
    • getLooger().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 plugins folder in Spigot Server Folder


  • Run the Spigot Sever
    When server start running, the text are printed in console of server

    Check the loaded plugin:


GitHub Link:

0 forks.
0 stars.
0 open issues.

Recent commits: