[WIP] How to create plugins

So, you want to create a new PowerNukkit plugin. Awesome! It’s pretty easy to start, just follow this tutorial and guidelines and you will be good to go.

Before you start your reading, notice that this tutorial has a Table of Content at the side of your screen, you can use it to navigate to the points of your interest.

Setting up the environment

First things first. You need a few things to work with your plugin appropriately. Like some software and fine-tune a few configuration files, if you are an expert or already know some of these instructions, you can just skip them.

Prerequisites

You are going to need 3 software:

JDK 8

You need to install JDK 8. I know, Oracle is at JDK 14 right now but trust me, you will have trouble soon or later if you run your server using JDK 9+ due to the new Java Module system (project jigsaw). JDK 8 is still being updated and is still supported by Oracle but you need a free Oracle account to download the newest version.

Download and install the appropriated JDK 8 for your system from:
https://www.oracle.com/br/java/technologies/javase/javase-jdk8-downloads.html

If you are using Linux and you have a package manager like yum, apt, pacman, zypper, you may use them to install a JDK 8 package instead, just make sure you are installing the Java Development Kit and not the regular Java Runtime Environment (JRE). The other doesn’t provide full support to compile Java files.

Git

It’s a version control software, it’s awesome to track your changes even if you don’t plan to release your plugin to the public. It’s not a real requirement to use Git but everybody uses it.

If you are using Linux, use your package manager to install git. If you are using Windows download and install it from:
https://git-scm.com/

IntelliJ IDEA / Eclipse / Any IDE

Seriously, you don’t want to write your plugin in notepad or directly from GitHub. Use an app that is designed to create Java programs, like IntelliJ IDEA or Eclipse SDK. I’m a big fan of Jetbrains IDEs so I greatly recommend using IntelliJ IDEA and I can’t help much with Eclipse because I don’t use it for years. So I’m going to use only IntelliJ in this tutorial.

You can download and install IntelliJ IDEA Community Edition (the free version is enough) from:

You can download and install Eclipse SDK (choose one for Java development, JavaEE is overkill) from:

GitHub Account

It will be easier for you if you create a GitHub account to store the code of your plugin using Git. They allow everybody to have private repositories for free now, so if you don’t want to share anything you don’t have to. It will be easier to track the PowerNukkit evolution and adjust your plugin as needed if you use the same site as us and you will also be able to use the templates that we provide with two clicks.

It’s not a requirement though, but it is helpful for you. To create a GitHub account access:

Creating a plugin project

Now that you have everything you can bootstrap your plugin project by accessing the PowerNukkit Example Plugin using the link bellow and then clicking on "Use this template"



Add a name to your repository, choose the repository visibility and click on "Create repository from template"