Bukkit Coding – (2) More Preparation

Once Eclipse has finished downloading, extract it’s contents somewhere you’ll be able to find it later. After running eclipse.exe, which should be included in the folder that you downloaded, you will be prompted to choose a destination for your workspace. This is where all of your files will be stored for your plugin.

After that window closes, you should be presented with the Eclipse IDE. This is where you’ll be spending your next few days and nights, in a life-like nightmare that seems to never end. Here, you’ll be sleep deprived, starved, and dehydrated as you toil through the horrid beasts that live inside. If you’re willing to face this battle, feel free to keep reading. Otherwise, please delete Eclipse, and burn your hard drive to keep the beasts from escaping.

Now that we’ve got that out of the way, we can continue. You should currently see the welcome screen of Eclipse. This gives a few options that allow you to explore Eclipse, and Java. Feel free to take some time to read through these. After you’re done, close out the Welcome Screen by clicking the X in the top left on the tab that says Welcome. Eclipse will now look slightly different.

This is what Eclipse should look like after closing the Welcome screen.

  1. Package Explorer – This is where your project(s) will be displayed. This allows you to easily switch between projects, and files in your project.
  2. Code/Text Editor – This is mainly going to be where you’ll be editing your code. At some points, you may also edit plain text files.
  3. Error Reporter – This is where errors in your code will show up. Any errors in here usually means you’re doing something incorrectly.

Now that you know the basic terms of different windows in Eclipse, we can continue with actually making our plugin. To do so, we’ll need to create a Java Project. Right click on the Package Explorer, and select New -> Java Project. You will now be presented with a window that contains what appears to be a very complicated mess, however, continuation is quite simple. Simply choose a name for your plugin, and type it under Project Name and click Finish.

You should now have a new package in the Package Explorer. Next, we must import Bukkit in our project so that we can use it’s API in Eclipse. To do so, right click on the package in the package explorer, and go to Build Path -> Configure Build Path. At the top of that window, choose the Libraries tab, and click on the Add External Jars button on the right side of that window. You will now be presented with a file browser, where you will need to browse to Bukkit. After selecting Bukkit, and clicking Open, Bukkit will be added to your project. You may now click the OK button to close the Build Path window. We can now create our package, and start programming our plugin.

To create a package inside of your Java Project, you’ll first need to open your Java Project. To do so, click on the white arrow to the left of your Java Project. This will open your project to view the contents of your project.

The next step, is to create a package in our Java Project. Each Java project can have several packages, but for now, our project will have only one package. To create a package, right click on the folder that says src and click New -> Package. This will bring up the Package Creation window. Type the following into the Name text field.

Be sure to replace YourName with your name, or alias, and PluginName with the name of your plugin. This is traditionally how package names are setup, however there are many alternative ways of naming your package. Your package name must be unique to your plugin.

Next, you must create what’s called a Main class file inside of your package. This is where most of your code is going to go (for now). To do this, right click on your package, and select New->Class. You can name it whatever you’d like, but I’d recommend naming it either “Main”, or the name of your plugin. I’ll name mine “Tutorial”. After creating your class, it should be automatically opened in Eclipse, and a few lines of code should already be present.

Let me just take a second to go through line-by-line explaining what this code does.

package com.elfin8er.tutorial; – This is defining where this class file is located. In our case, it’s located in the package com.elfin8er.tutorial. Notice how this line of code ends in a semi-colon. This means that we’re done with that line of code.

public class main { – This line, is like the main constructor of our code. This is where all of our plugin code will be kept. Notice the curly brace at the end of this line? This is the start of this codes body. Any code in between this curly brace, and the next curly brace, is part of this codes body. Also note how there is no semi-colon because this line has a body.

} – This second curly brace marks the end of the body from the previous line of code.

All of this may seem a bit complicated, but it shouldn’t matter a whole lot for now.


  1. Like the simplicity of this new tutorial. Under page (2), you have to browse to and add Bukkit to your project as an external library. Exactly what has to be added assuming all steps up until then have been completed? I see a lot of jars in the folder where I created Bukkit but not sure which one to add.

    • May have answered my own question but might be good for other “noobs” such as myself. On page 3 there’s a reference that has to be added that I did find in the “spigot-1.12.jar” file on my machine.

      • Yes sir, you are correct. Sorry about the confusion. If I’m understanding correctly, you’re asking which jar file you have to add from BuildTools? You can add either the spigot-1.12.jar or the craftbukkit-1.12.jar file. Thanks for letting me know about the confusion though. I’ll see about adding pictures to hopefully clear that up for future readers.

Leave a Reply

Your email address will not be published.