Skip to content

Instantly share code, notes, and snippets.

@kangarko
Last active April 2, 2024 11:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kangarko/456d9cfce52dc971b93dbbd12a95f43c to your computer and use it in GitHub Desktop.
Save kangarko/456d9cfce52dc971b93dbbd12a95f43c to your computer and use it in GitHub Desktop.
15-Minute Minecraft Plugin Tutorial For 1.8.8 - 1.20

15-Minute Minecraft Plugin Tutorial For 1.8.8 - 1.20

In this new Minecraft plugin development guide, I'll show you how to make Minecraft plugins for Bukkit, Spigot and Paper.

This guide covers Minecraft plugins for 1.8.8 to 1.20.

We'll be using IntelliJ with a dedicated extension for Minecraft plugin development to make this process fast and easy.

If you're tired of limiting plugins and waiting for developers, if you want to make a truly unique servers customized from the ground up, click here and I'll show you how to do it in 20 days (without experience).

1. Introduction

What is Bukkit, Spigot and Paper?

Bukkit, Spigot and Paper are modifications to the original Minecraft server software made by Mojang, which add support for plugins, configuration options and performance enhancements.

What is a Minecraft plugin?

A Minecraft plugin is an extension for Bukkit, Spigot and Paper server used to create events, commands, tools, minigames, monsters etc.

This is different than Minecraft Mods which add new features to Minecraft itself, requiring each player to download the same mod.

2. Getting Started

Installing IntelliJ IDEA

Download and install IntelliJ IDEA Community Edition. IntelliJ is the software I'll be using to make Minecraft plugins. It's used by official Google Developers to write Android apps, you can't go wrong with it.

To install Minecraft Plugin Development, open IntelliJ, go to File > Settings > Plugins, type "Minecraft" in the Marketplace tab and install the plugin.

Installing Minecraft Plugin Development

Creating A New Project

Now, click New Project and configure it using the following options:

Creating A New Project

  • Name: Your plugin's name.
  • Location: Where your plugin's code will be stored locally.
  • Platform Type: Select Plugin.
  • Platform: Select Bukkit.
  • Bukkit Platform: Select Paper.
  • Minecraft Version: Select your version. If you want to code for 1.8.8 or anything else, leave at latest and see the step below.
  • Plugin Name: Should be equal to Name.
  • Main Class: Where the main part of the code is located. The path is a reverse domain name which can either be your website (com.matejpacan), your email (com.gmail.matejpacan) or just "me.matejpacan", followed by the plugin name (here custommob), and then the class (here CustomMob), such as org.mineacademy.custommob.CustomMob.
  • Build System: Choose Maven.
  • JDK: Select Java 17 for Minecraft 1.17-1.20, otherwise should be Java 8. Install the appropriate version from this link.

Click Create New. A new project should generate.

Project Structure

The new project should contain the following structure:

Project Structure

  • src/main/java folder (this is where your code is) with your main package derived from the main plugin's class path we created above, and your main plugin's class.
  • src/main/resource folder (this is where config files are) with plugin.yml, which is a file that the server uses to locate your main plugin's class and plugin information
  • pom.xml file used to convert all code and files into a single .jar file you can place into your plugins/ folder as a fully functional plugin

Notice for Minecraft 1.8.8 - 1.16

Paper no longer stores old Minecraft versions at their repository so we have to switch to Spigot.

Visit Spigot Maven Repository.

Replace <repository> and <dependency> with paper to Spigot from the page above.

For Minecraft 1.8.8, it should look like so:

<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.8.8-R0.1-SNAPSHOT</version>
          <scope>provided</scope>
      </dependency>
  </dependencies>

3. Compiling

I have placed the following test line into the onEnable() method in the main plugin's class:

getLogger().info("Hello MineAcademy.org!");

Then I run the package goal to compile the plugin.

Compiling The Plugin

It should open a console window and say Build Success. You can ignore the warnings:

Build Success

The finished plugin will be in the target/ folder inside your plugin's source folder:

Target Folder

4. Testing

Running A Local Minecraft Server

Obtain a copy of your Paper version from papermc.io.

Then create a running script, depending on your operating system:

Windows Server Script

Create a run.bat script.

java -Xms4G -Xmx4G -jar paperclip.jar nogui
pause

macOS Server Script

Create a run.sh script.

#!/bin/bash
cd "$(dirname "$0")"
exec java -Xms4G -Xmx4G -jar paperclip.jar nogui

Linux Server Script

Create a run.sh script.

#/bin/sh
java -Xms4G -Xmx4G -jar paperclip.jar nogui

Place both paperclip.jar and the script in the same folder, let it run, accept the eula.txt and run again and type "stop" to stop it properly.

Finally, drag your plugin .jar from target/ into plugins/ folder, start again and voila, you have your first Minecraft plugin!

I can see my message flashed in the console when the plugin got enabled:

Plugin console Message

Connecting To Your Server

Just run your Minecraft client, open Multiplayer, choose Direct Connection, type localhost for your server address.

Once you joined your server, you can type /plugins and you should see yours listed in green. Mine is listed as "CustomMob".

Loaded Minecraft Plugin

Next Level: Making Advanced Minecraft Plugins

There is only so much I covered today.

If you want to learn to build minigames, custom mobs, enchants, anti-cheats, GUIs, display entities etc., I prepared a full-featured Minecraft plugin training.

Best, I'm on there 2x/week doing live coaching to answer any questions - you can even unmute yourself and share screen to get your code reviewed, live.

I've been making Minecraft plugins and Java applications since 2011 and I taught people who had zero coding experience as well as professionals running profitable networks. Click here to learn more and I'll see you inside!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment