How To Code Plugins For Minecraft

Writing A Safe Oncommand

How to code a Minecraft plugin in 10 minutes

When writing an onCommand, it’s important that you don’t assume any information, such as the sender being a Player. Things to keep in mind:

Make sure the sender is a Player before casting

Using simple code like this makes it possible:

Check the arguments length

Don’t always assume the sender typed the correct amount of arguments.

Check if a Player is online before getting them

Sometimes you want to get another player by the name entered by the player. Always make sure the player is online!

If you need to modify a Player currently not online, the OfflinePlayer class provides basic manipulation methods.

Reported Effects On Spigotcourse

Testing code TAKES TIME. Must restart each time.Testing code is EFFORTLESS. No reload needed!
Code becomes HARDER over time.Code stays BEAUTIFUL and CLEAN over time.
Solving errors is PAINFUL and TIRESOME.You UNDERSTAND errors and IMPROVE after solving each one…
Your plugins ARE NOT SELLING& you don’t understand WHY.Your plugins SELLING & you understand WHY.
You are trying, but NOT GETTING RESULTS.Results are CONTINUOUS.

We Bring Minecraft Where It Used To Be

Most server owners get stuck in a cycle of constant updates, broken plugins, frustrated with errors, micromanaging players and wasting time.

They know very little about coding or rely on friends or developers to make plugins for them. New Minecraft updates break stuff, developers become inactive and its too hard and frustrating to do everything yourself and keep up.

Existing plugins dont do what you want them to do. They are hard to configure and cannot be translated into your own unique style and needs.

Most people have amazing ideas but they never transform them into reality because they dont have enough time, no idea how, get overwhelmed or simply run out of money.

The servers end pretty empty and if new people show up, they dont stay because its empty. Server owners lose motivation for the game. Some wanted to continue but bigger networks came in, wiped their player-base away and left them helpless.

At the end, many server owners have to close their server.

You May Like: How Do You Record Minecraft On Pc

How To Write A Minecraft/bukkit Plugin For Spigot 114

The Minecraft community seems to have an obsession with doing everything on YouTube. For some people thats great, but as someone who is already a coder and I just need to know the environment-specific details for coding for Minecraft I have a really hard time sitting through an hour of tutorial videos just to get the four things I needed to know that I didnt already know how to do. This is where having a text and pictures version of a tutorial comes in handy, so you can skim through it looking for the parts you still need to know, and easily skip over the stuff you already know. Another friend of mine was also recently trying to get into writing a plugin for Spigot, and everything I could find to point him at which was text-based rather than a YouTube video was very outdated, had instructions that were no longer relevant because Bukkit and Spigot and Eclipse have all evolved since then, etc. So I figured Id write one, and here it is!

Update: since writing this up, I discovered a very nice page on the Spigot Wiki documenting much of this, which seems to be mysteriously absent from the search engine searches I did trying to find this information . How to create a Minecraft/Bukkit/Spigot plugin on the SpigotMC website. Im posting this anyway because I do a few things differently. Pick your flavor.

How To Add Plugins To A Minecraft Server

Bukkit Coding


Plugins provide a way for you to customize your Minecraft Server in infinite ways. You can add an economy, new mobs, items and so much more. There are tens of thousands of plugins to choose from. Whats great about Plugins is that they require nothing from your players, as they work with Vanilla Minecraft.

To use plugins, you will require a special type of Minecraft server. In the past, the most popular choice would be Bukkit. But today, its better to use either Spigot or Paper, as both are more optimized.

In this guide, well show you how to install a Minecraft server as well as some plugins. Weve also created many more Minecraft Guides which you are welcome to read.

Recommended Reading: How To Play Minecraft On Pc

Your First Success Is The Hardest To Get

Not only I had little knowledge what licensing really means, I was naive enough to “borrow” some of the features without really understanding the code .

Soon I ended up being banned from the forums, and I thought that my “career” as a developer had come to an end.

Luckily enough I learned from my mistakes and I was able to publish after some time.

The same year, 2013, I decided to migrate to Spigot and publish my most advanced plugin ChatControl there. It was a plugin preventing the game chat from being abused, including numerous antispam features.

In reality, the plugin sucked. It was just like the free plugins I was complaining about, but now there was no-one else to blame…

In the meanwhile, my server had expanded and so were the demands. As years went by, countless of weeks spend on developing, bug-fixing, figuring things out on my own and banging my head against the wall over and over only to find that the easiest solution was often more simple than I expected.

Fast forward, it’s 2015. My server is at its peak, reaching over 50,000 unique players ever joined and making its way to being a little known in the community. Spigot had opened their premium resources the year before already, but I was hesitant.

I didn’t want to sell. All I wanted was to code plugins for my server and maybe publish a few so other people could benefit from them.

Then, something unexpected happened.

So How Do I Use Plugins


Every plugin is different, but they all function similarly. Most plugins use a mechanic called commands. Commands can be typed into the server console or the game chat. To find the commands list of the Plugin that youre using, check its Curseforge page. For the sake of this blog, Ill be using Essentials as it is one of the most popular plugins.

If youre not using the in-game chat rather than the server console to input commands, follow every command with a / behind. Also, note that most commands that have a heavy impact on gameplay likely require OP permissions.

If youre having trouble finding out what commands are possible with your plugins, try the help command by typing help in the console or /help in the in-game chat. Typically, a list of all possible commands will be brought up. Sometimes, depending on the plugin, you might have to write out the name of the plugin after help. That would be done like this: help

If there are any unique functions or commands that are specific to the plugin, it should be mentioned in the help section along with how it impacts the server.


The stereotypical roles usually consist of Helper, Moderator, Administrator, Owner, all with escalating permissions that can either be based on presets defined by the plugin of your choice, or customized by yourself. Each plugin requires different commands and methods of making custom roles, but most dont require any configuration files.

Configuration Files

  • Profit!!!
  • Recommended Reading: Free 24 Hour Minecraft Server Hosting

    Certificate Of Course Completion

    That’s right. After finishing this course you will get a certificate of your knowledge.

    There are two certificates for both series of the course.

    • The 1st certificate in Fundamental Series covers the Java language course together with the SpigotAPI.
    • The 2nd certificate in Mastery Series covers the selling section, including sales, copywriting, and design.

    Those certificates are obtained after you complete the course.

    Learning How To Code Quickly Without Prior Experience

    Fastest way to code Minecraft plugins (without experience)

    This option is suitable for 99% of people. Even if you need an extremely large solution like Mineplex or Hypixel, you still need to understand at least the basics so you wont need to ping your developer team each time you need to change a simple message in the code for you.

    Coding is easier and faster than most people experience. The problem out there is a lack of quality resources, proven systems to follow and professional guidance to help you get unstuck. And as you probably know, if youre a beginner, youll get stuck a lot.

    Getting Started With Coding For Free

    Here are some great starting points for coding plugins. Minecraft updates rapidly and plugins break, so I really tried to write this article in an universal and future-proof way to avoid putting out a version-specific advice out there.

    Understand This Before You Start

    Minecraft is coded in Java. Everything we do will have to do with the Java programming language. If you never coded anything before, or you dont understand the Java programming language, you need to learn it before you can developer great Minecraft plugins. Yes, this tutorial is designed as a jumpstart right into production and we will not cover how Java works in general, but for most people you need to learn it simultaneously if you are serious about your progress.

    Also Check: Minecraft Server Hosting Mod Support

    I Never Thought This Was Possible

    I loved it.

    I had all of these great ideas in my head when I realized that the plugins on the market could not fulfill them.

    in order for my server to truly differentiate itself, I had to code own in features myselfHiring various developers turned out not only to be expensive and risky, but the constant need of fine-tuning, delays in communication, testing and innovating features become too complicated and slow.

    It seemed impossible at first. I tried to learn from various sources, including videos, articles and even self-teaching as I decompiled others’ products and tried to mess around with their source.This turned out to be a disaster…

    Minecraft Plugins In Typescript

    Lets get started building your first CustomRealms plugin. First, go to and sign up for an account.

    Once youve created your account, youll be sent to the CustomRealms dashboard. On the dashboard, you can manage your servers, code plugins, or you can browse the Plugin Store where you can publish your plugins for others to use on their servers!

    Were interested in building a Minecraft plugin, so click on Code Plugins on the sidebar.

    Click the big green Create button on the top-right corner of the page. Give your plugin a name. For this tutorial, well be calling it My First Plugin, but you can name it whatever youd like!

    Once youve created your plugin, youll see the plugin manager page. Later on, you can fill in the other info about your plugin, including the icon, cover photo, and description. But well skip that for now!

    To get started coding, click Launch Editor in the blue box! Get ready for the fun part!

    You May Like: How To Get Minecraft Code

    Installing From Multicraft’s Plugin List

  • Log into your Multicraft control panel. On the left sidebar menu, navigate to Files > Plugin List.
  • In the Plugin List page, look for the plugin you would like to install. You may use the and Category filters to narrow the list down or type the plugin name under Name to search for specific plugins. Once you’ve located the plugin, simply click on the name to navigate to the plugin information page.
  • On the plugin information page, select the plugin version that is compatible with your server’s version. You may use the table on the right-hand side of the page to check which plugin version to use on your server.
  • Once you have selected the correct version, click Install. After a few seconds, the status will be updated to Installed to indicate that the plugin was successfully installed.
  • Restart your server to allow plugins to load and the additional plugin files to be generated.
  • You’re done! You will now be able to use and configure the plugin to your liking. You can check on the plugins installed on your server by using the command /plugins in-game and plugins on your console.

    How To Add Plugins To Spigot

    Bukkit Coding

    Plugins are add-ons to your Minecraft server, changing how you play the game. Minecraft servers are often shared with friends and others so they can join. With some plugins, you can add new features such as altered NPCs, in-game economy, and making everything in a part of the world indestructible.

    Think of plugins as browser extensions, but for Minecraft servers instead of Google Chrome. Plugins dont modify the game at all, as that is what mods do . As such, plugins tend not to cause changes as radical as mods can.

    Despite this, plugins are attractive due to their convenience. Installing mods will require you to change your copy of Minecraft in some way. Plugins instead only get installed on the server, so theres no risk of altering your game files in a harmful way.

    You May Like: What Is The Best Minecraft Hosting Service

    Setting Up Your Development Environment

    Install Java

    You need the Java Development Kit, not the Runtime Environment. Download the Java SE JDK from Oracles site. Make sure you get the JDK, not the JRE, and make sure you have the correct one for your operating system. only has JREs, you have to go to Oracles site for the JDK. Linux users can try installing the java-8-openjdk package.

    Note for OS X users: OS X no longer ships Java by default. It will automatically install if you try to run something that needs Java, however, the version it installs is old and Bukkit/Spigot development requires at least Java 7, so you will need to download the newer Java even if you already have the system Java.

    You need to link against Spigot in order to compile plugins, so youll need a local copy of Spigot to link to, even if you never actually run it.

    Download BuildTools.jar from

    Place it in an otherwise empty directory. Open a command prompt and navigate to the directory you placed it it. Run the following command to build it:

    java -jar BuildTools.jar

    This will probably take a while. If all goes well, you should get a file called Spigot-1.14.2.jar in the same directory with BuildTools.jar . Remember where this directory is, youll need it later when creating the project in Eclipse.

    Install Eclipse

    You can get Eclipse here:

    Mac OS X: /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jreLinux: /usr/lib/jvm/java-8-openjdk-amd64/jre

    Spigotcourse Is For Me If

    • I have a ton of unique plugin ideas but don’t know how to turn them into reality!
    • I never released any plugin and I don’t know how to code
    • I tried to hire people to code plugins but it didn’t work out…
    • I have a BungeeCord network and need an advanced solution!
    • I want to bring more players to my server by offering something unique!
    • I cannot find any good plugin that satisfies my needs
    • I tried to watch video-tutorials but they were outdated, confusing or had poor programming practices…
    • My premium plugins are not selling well and getting leaked
    • I’m running out of money to finance my server.
    • I want my server to be unique, to stand out…

    You May Like: Code Org Minecraft Hero’s Journey

    Spigotcourse Contains Over 24 Hours Of Footage

    As such, I decided to split the course into two series:

    • This prevents you from watching 24 hours long course of which half you don’t need.
    • It makes the price lower for each one to make it more affordable.

    PS: If you are a hardcore dude and you go for both packages, I have a special offer for you, too!

    Adding Your Command To The Pluginyml

    Bukkit Coding | Episode 2 – MOTD Plugin | How to code a minecraft plugin

    You will also need to add the command to your plugin.yml file. Add the following to the end of plugin.yml:

    name:Basicmain:< main package> .< main class> version:1.0author:< your IGN or name> commands:basic:description:This is a demo command.usage:/< command>  permission:< plugin name> .basicpermission-message:You don't have < permission> 
    • basic – the name of the command.
    • description – the description of the command .
    • usage – the help dialog that users will see when you return false in the onCommand method. Write clearly, so that others can discern what the command is and how to use it.
    • permission – This is used by some help plugins to work out which commands to show to the user.
    • permission-message – This is output when the player attempts but does not have permission to use the command.

    Note that yml files use 2 spaces for tabs, as the tab character will cause problems.

    You May Like: How Do You Make Your Own Minecraft Server For Free

    If You Are A Beginner Spigotcourse Will

    • Start your development journey towards becoming an elite level programmer in Java while playing Minecraft!
    • Empower you with programming skills from scratch so you understand how to code at a high level.
    • Give you a clear, step-by-step KNOWLEDGE of the majority of the SpigotAPI that we use for making plugins.
    • Show you concrete REAL-LIFE EXAMPLES so you can implement what you learned right away.
    • Introduce you to the world of SALES and how to become successful by publishing premium resources.

    Adding Your Own Plugins

    If you managed to code your own plugins, then you can install them to test them out. The process is the same as all plugins. Heres how youll install them:

  • Create a plugin.
  • Restart your server.
  • After restarting, your personal plugin should be working as you enter the server.
  • As long as you code everything right and for the particular Minecraft version your server is running, there shouldnt be a problem.

    Recommended Reading: How Much Is Minecraft On Ps4 At Walmart

    Creating The Plugin’s Class

    Now that we have our project set up we can start to add class files and begin making our plugin. The plugin’s main class is the class that extends JavaPlugin. There should only ever be one class in your plugin that extends JavaPlugin either directly or indirectly. It’s always good practice to create your main class first and give it the same name as your plugin. Right click on the package you created before, and select New > Class.You should have a new class similar to the following

    package. publicfinalclassextendsJavaPlugin
    Warning: Plugins should never invoke their constructors and create new instances

    Popular Articles

    Related Stories

    Stay on op - Ge the daily news in your inbox