Creating a Minecraft Plugin
1. You need to be proficient in Java
2. You need to know about general programming concepts
· Download the necessary files.
· Create an eclipse Java project.
· Create a plugin.yml.
· Learn some bukkit basics.
· Learn some bukkit advanced topics.
Downloading the Necessary Files
Go to the server download site and download your minecraft server version.
Go to the eclipse download site and download the current version of eclipse if you do not already have it installed.
Go to the spigot download site and download the corresponding version of bukkit/spigot to your server version.
Create an Eclipse Java Project
Set up a new Java Project by clicking “create java project in the top corner”
Next, right click on your project and look for import external jars.
Now, find your bukkit/spigot file and select it in the list.
Create a plugin.yml
In the project path, create a file called plugin.yml
Follow this format, and insert information about your plugin and your name and other details.
description: This plugin is so 31337. You can set yourself on fire.
# We could place every author in the authors list, but chose not to for illustrative purposes
# Also, having an author distinguishes that person as the project lead, and ensures their
# name is displayed first
authors: [Cogito, verrier, EvilSeph]
depend: [NewFire, FlameWire]
description: Set yourself on fire.
aliases: [combust_me, combustMe]
usage: Syntax error! Simply type /<command> to ignite yourself.
description: List how many times you have died by fire.
aliases: [burning_deaths, burningDeaths]
Example: /<command> - see how many times you have burned to death
Example: /<command> CaptainIce - see how many times CaptainIce has burned to death
description: Gives access to all Inferno commands
description: Allows you to ignite yourself
description: Allows you to see how many times you have burned to death
description: Allows you to see how many times others have burned to death
For more information on creating a plugin.yml, go here: https://bukkit.gamepedia.com/Plugin_YAML
The basics of bukkit are fairly easy to learn. Bukkit is the base package of everything. Then, one can use Bukkit.server to be able to get the server object and be able to perform actions on server objects.
Using the Server object, one can perform actions such as:
- Ban/Ip ban players
- Broadcast Messages
- Create Worlds
- Change Server Settings
- Terminate the server
One can use Bukkit.getServer().getOnlinePlayers() to be able to get the list of all online players. One can also use a method similar to this to be able to get a specific Player object. The player object has many parameters and methods.
Here are a few actions one can perform with a Player object:
- Add potion effects to the player
- Damage the player
- Change the player's permissions
- Give the player experience
- Open menus for the player such as the enchanting menu
- Play sounds to the player
- Give the player a custom name
- Give the player a velocity
- Teleport the player
One can also get many other useful Bukkit objects such as an Inventory, Entity, or Creature.
Try some basics: Get your player by searching for your name when you type a command and use your player object to give yourself a velocity. You should see your player move if you do this correctly. Look up documentation on commands on how to register the command.
The events system in Bukkit is not too complicated. However, it’s important to learn and understand it. First, you need an eventhandler and to make it listen for events. You need to do this in your main plugin class, ideally, on plugin start up. Details on doing this can be seen here:
Then, you can listen on specific events and execute code when the events occur. Simply name a method with the same name as the event name and put @EventHandler above the method so the compiler knows the method is an event.
Bukkit does not support some features such as Custom Mob support. To do this, you will need to use NMS. You will find some guides on this however, it is quite complex and I do not recommend doing this unless you really need it.
I’ve showed you some of the ways that you can get a Bukkit plugin up and running and how to accomplish some basics in one. For more guides on bukkit specifics see my list below of great guides. Now, go get out there and make some awesome plugins!