[Java] Spigot(Paper) How to make 2020 plug-in Introduction #01 (Environmental Construction)

5 minute read

This time, I’d like to create an original plugin using a custom server called Minecraft’s SpigotMC (Spigot). I hope to help you understand the whole picture of making a plug-in while making an original plug-in.

I would like to explain it as carefully as possible, but I think that there is a part that requires prior knowledge. I finished building the Java environment at another introductory site and vaguely understood the basic grammar of Java, control syntax such as if statement and for statement, class and method and issued Hello World, but I do not know what to do next !! For those who want to take such a step, we aim for such content. (For those who are not confident and haven’t finished yet, The easiest Java introduction,JavaintroductionLet’sreadwithonehand!)

Please point out any mistakes in this article! Let’s get started!

*This article is being edited…

Next article → (Spigot(Paper) 2020 plugin making method introduction #02 (subtitle undecided))

Goal of this article

  • Can build Spigot plugin environment
  • Create project


It is an environment construction of Onimon!

I think that the basic Java development environment is complete, but if you have not done so yet, please try building the Java development environment once referring to the Java introductory article. The following is a summary of points to note when constructing a development environment for Spigot(Paper) plugin. Let’s do it slowly without rushing!

About editor (IDE)

Any editor is fine. This article uses IntelliJ IDEA 2019.3.5. At the time of writing, the latest IntelliJ IDEA 2020.1.1hasbeenreleased.IDEA2019.3.5](https://www.jetbrains.com/en-us/idea/download/other.html). image.png

Notes on JDK version

There are two main types of JDK used for development: Oracle’s JDK and OpenJDK, but either one is okay. But the version needs to be careful. (important!)

__ ① Java version that executes Spigot ≧ ② Java (javac) version used when compiling the plug-in __

It must be If the Java version used for compilation is higher, the plug-in may not be loaded properly. If there is a person who says “I was able to build the plug-in, but it does not load properly due to an error when loading the plug-in”, please review the Java version. (Some people stumble here…) That said, basically, ① Java SE 7 or lower should not be used for Spigot execution (as of 2020/5/30), ② For Java(javac) used for plug-in compilation, Java SE 8 If you have selected the Oracle JDK (download link), I don’t think there will be any problems. I don’t know! If so, download Java SE 8 Oracle JDK and install it.

How to check the version of Java (Java that executes Spigot)

Launch a command prompt and run ```java -version


It's 1.8.0, but it's Java 8.

C:\Users\username> java -version
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)

If the version is not displayed The path to the java command may not be in the path. (See https://www.javadrive.jp/start/install/index4.html for information on how to pass the path to the java command.)

C:\Users\username> java -version
'java' is an internal or external command,
It is not recognized as an operable program or batch file.

How to check the version of Java (②Java used when compiling the plug-in)

In IntelliJ IDEA Community, you can select a JDK for each project.

A project is a directory that holds everything that makes up an application. (Quoted from https://pleiades.io/help/idea/working-with-projects.html)

  1. Open the project for which you want to check the JDK version.
  2. From the menu above, open File → Project Structure → Project. image.png


In the introduction, you may have compiled and executed the class file using the javac command etc., but it is difficult to manage because there are many dependencies and necessary files when creating a plugin. So I will use Gradle for the build. Gradle is a tool for managing various source files and dependencies, and compiling and building into one jar file.

Gradle comes with IntelliJ IDEA from the beginning, so you don’t need to install a new one.

Prepare test server

You need a server to test your plugin. This article uses Spigot. The latest version is 1.15.2. There is a PaperMC on the fork, but that is okay. (See https://blog.mkserver.jp/2019/05/19/spigot-server-build/ for how to build Spigot server)

Environment at the time of writing

The environment at the time of my writing.

Tool Item Name Version
IDE IntelliJ IDEA Community Edition 2019.3.5
JDK Oracle JDK 1.8.0_251”
Build Tools Gradle  
Test Server Spigot MC 1.15.2
OS Windows 10 1909

Creating a new #Spigot plugin project Let’s start making a plugin for Spigot! This time, the goal is to put Hello Minecraft Plugin!! in the chat field when logging in to Micra.

Install Minecraft Development

Before starting development, install Minecraft Development if you have not already done so. image.png image.png If you search for “Minecraft” and find Minecraft Evelopment, click Install to install it. After the installation is complete, exit IntelliJ IDEA and restart. Minecraft Development is an extension of IntelliJ IDEA that creates a template for Spigot plugins.

Open IntelliJ IDEA

Open IntelliJ IDEA! Click ```Create new project



## Creating a new Spigot plugin

Check Spigot Plugin and select the desired JDK from ```Project SDK:
#### **`.`**

The JDK selected here is Java used when compiling the plug-in. image.png

Untitled 4.png

  • Group ID is the name of the group to which the plugin belongs. Make sure your name does not overlap with other plugins. ⇒ It has been changed to ```com.github.rnlin.tanosii



  • Artifact ID is a name to distinguish plugins. ⇒ changed to ```originalplugin



  • Version is an early version of the plugin. If you don’t have any particular requirements, you can leave it as it is. By the way, SNAPSHOT is used by convention in the sense that this version is still under development.

Finally select Maven → Gradle and click Next.Untitled 5.png

You don’t need to change much. Only in one place, Main Class Name is com.github.rnlin.tanosii.originalplugin.Originalplugin, but change it to ```OriginalPlugin


Since it's a great deal, I have adapted it to the Java coding standard! Let's keep a habit of looking at coding standards...! (I will do my best...)
(See Java Naming Conventions: https://future-architect.github.io/coding-standards/documents/forJava/)

For the ```Original Setting
#### **` below, please set it to your liking.`**

This item is a setting item written in plugin.yml and can be changed later. I set only Description and Autohrs! Click ``` Next


![Untitled 5.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/638023/43888e35-187b-a834-387e-df24a09e4086.png)
Set the project name and the folder to save the project.
The project name is the same as the artifact ID (original plugin).
Make sure the folder you save is easy to understand!
Click ```Finish
#### **`.`**

Congratulations! !! This completes the environment construction and project creation!