Skip to content

Instantly share code, notes, and snippets.

@PabloB07
Forked from briangershon/README.md
Created July 3, 2022 22:17
Show Gist options
  • Select an option

  • Save PabloB07/b7e8f00ff9f140b56250c59624febe4a to your computer and use it in GitHub Desktop.

Select an option

Save PabloB07/b7e8f00ff9f140b56250c59624febe4a to your computer and use it in GitHub Desktop.
Minecraft Plugin Development Guide

Minecraft Plugin Development Guide

For those new to Minecraft Plugins, there's a lot of new and old documentation to run through on the web.

Additionally plugins compiled on newer versions of Java weren't working on older stable Minecraft server versions.

I've captured my learning in two places.

What is a Minecraft plugin?

A plugin in a Java module that runs on a Minecraft server, and be used to create commands, games, tools for editing the world, etc.

This is different than Minecraft Mods which actually change and add features to Minecraft itself.

To test your plugin, you need a Minecraft server running locally on your machine, and there are many servers. Spigot and Paper are two popular ones.

Getting Started

I started with Creating a blank Spigot plugin, using Maven.

Then took a slightly different path:

  • using Eclipse instead of IntelliJ
  • compiling the plugin directly via the terminal and not rely any specific IDE

Environment Setup and Workflow

I've tested this guide on MacOS with these dependencies:

  • Java 14 was installed
  • Installed Maven via Home Brew (brew install maven).

Run a local Minecraft server

I installed Spigot into ~/spigotmc.

In one terminal window, I run Spigot via my run.sh script:

#/bin/sh
java -Xms2G -Xmx2G -jar spigot-1.16.4.jar nogui

# java -jar BuildTools.jar

I can then restart/reload this server as I iterate on the plugin.

Code Editing

Edit plugin via Eclipse for nice code auto completion.

Test the plugin

I use a second terminal session for compiling and copying the plugin to the local server.

mvn clean package
cp target/PluginDemo-n.n.n.jar ~/spigotmc/plugins/

Flip over to ~/spigotmc terminal and type reload. Or if server not running use run.sh script.

You can then run the Minecraft client, choose Direct Connection, type localhost for Server Address. Inside Minecraft, you can type /plugins and you should see yours listed.

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