Step 3: Your First Plugin
What is a plugin?
A plugin is a file we will add into our "plugins" folder that contains new code that our server will use. There are two types of plugins to be aware of, server plugins and client plugins. Server plugins are those only needed by the server, generally dealing with managing how the world works and what you can do in it, along with money, permissions, and protecting things. A client plugin is installed by the player and can change the looks and sounds of the game along with how the world works. To play multiplayer with client plugins, the server must also have the plugin installed. I don't use client side plugins for my after school group currently as I don't have the rights to the computers the students use and it would be very hard to make sure everything is working properly each week.
I don't use any client plugins for my setup as keeping both server and clients up to date when I have no access to the client profiles makes it impossible. So for this guide we'll just be ignoring all the client plugins out there.
One other thing to be aware of with plugins, is that they can sometimes require other plugins to be installed along side them before they can work, some of the more common ones that most servers use are Vault and TuxTwoLib to provide a kind of interpreter between two plugins, such as a banking plugin talking to a shop plugin. I'll cover these as needed. I also tend to refer to plugin's as mods, because in most games that is what they are called and I've been using that terminology for years so its a bit of habit. Just know I mean the same thing when talking about plugin and mods through out the tutorials.
I don't use any client plugins for my setup as keeping both server and clients up to date when I have no access to the client profiles makes it impossible. So for this guide we'll just be ignoring all the client plugins out there.
One other thing to be aware of with plugins, is that they can sometimes require other plugins to be installed along side them before they can work, some of the more common ones that most servers use are Vault and TuxTwoLib to provide a kind of interpreter between two plugins, such as a banking plugin talking to a shop plugin. I'll cover these as needed. I also tend to refer to plugin's as mods, because in most games that is what they are called and I've been using that terminology for years so its a bit of habit. Just know I mean the same thing when talking about plugin and mods through out the tutorials.
The First Plugin - ChestRegen
Lets get a simple plugin that doesn't require any others to work. This plugin lets players with OP status make chest that infinitely regen their contents, very useful in many situations where you only want to give out very specific items to each player, such as a starting pack of equipment.
The plugin is called ChestRegen and a link can be found in The plugins page. Remember to give the plugin a good review if you use it in your server, it helps encourage coders to keep making the great tools we have.
On the Spigot website which has thousands of plugins to search for, you'll generally find all their pages are laid out the same. With some information about the plugin at the top, then the commands you need to know to use it, and some permissions settings that we will talk about later. In the top right you should see a Blue button that says "Download Now". Click on it and it will download a file called "ChestRegen.jar" to your computer.
We want to move the file to our servers "plugins" folder. If the server is already running, you'll need to stop and restart it before the plugin will load. After your server has restarted and if things worked properly the plugin will create a new folder in plugins called "ChestRegen". This is where it will keep its configuration information.
Join your Minecraft server with your character and lets see if everything worked. Type in the command "/plugins" and it should show you a list of all plugins that you have on the server. Green names mean the plugin is working, Red names mean the plugin has been detected, but something failed during start up.
Now lets try out our new plugin, type in the command "/gamemode 1" to be in creative mode. Now open your inventory and add a chest to your item bar and grab a diamond as well. Put down a chest and put the diamond inside of it. With your mouse looking at the chest, type the command "/cr regenchest perplayer time:1" and it should tell you that it has turned the chest into a regenchest. The number 1 we added is telling it to automatically regenerate the item inside every minute. Go ahead and right click the chest and it will take the diamond out, wait a minute, and see if another one given to you. You can all use the "/cr regen" command while looking at the chest to force it to regenerate.
Now try reading the "/cr help" information to find out other ways to use this plugin. Currently creating non-perplayer chest is broken as items won't regenerate correctly, but I only use perplayer chest anyway for ease of use.
The plugin is called ChestRegen and a link can be found in The plugins page. Remember to give the plugin a good review if you use it in your server, it helps encourage coders to keep making the great tools we have.
On the Spigot website which has thousands of plugins to search for, you'll generally find all their pages are laid out the same. With some information about the plugin at the top, then the commands you need to know to use it, and some permissions settings that we will talk about later. In the top right you should see a Blue button that says "Download Now". Click on it and it will download a file called "ChestRegen.jar" to your computer.
We want to move the file to our servers "plugins" folder. If the server is already running, you'll need to stop and restart it before the plugin will load. After your server has restarted and if things worked properly the plugin will create a new folder in plugins called "ChestRegen". This is where it will keep its configuration information.
Join your Minecraft server with your character and lets see if everything worked. Type in the command "/plugins" and it should show you a list of all plugins that you have on the server. Green names mean the plugin is working, Red names mean the plugin has been detected, but something failed during start up.
Now lets try out our new plugin, type in the command "/gamemode 1" to be in creative mode. Now open your inventory and add a chest to your item bar and grab a diamond as well. Put down a chest and put the diamond inside of it. With your mouse looking at the chest, type the command "/cr regenchest perplayer time:1" and it should tell you that it has turned the chest into a regenchest. The number 1 we added is telling it to automatically regenerate the item inside every minute. Go ahead and right click the chest and it will take the diamond out, wait a minute, and see if another one given to you. You can all use the "/cr regen" command while looking at the chest to force it to regenerate.
Now try reading the "/cr help" information to find out other ways to use this plugin. Currently creating non-perplayer chest is broken as items won't regenerate correctly, but I only use perplayer chest anyway for ease of use.