Downloading Eclipse
-----------------------------------
1. Download eclipse from eclipse.org.
2. Run the download and install it with default settings.
3. When installed, launch it. it will take a breif while for it to load the first time.

Creating your first plugin
-----------------------------------
1. Click the (X) on the welcome screen to open the main editor. There will be two parts referred to in this tutorial: The File Hierarchy and the Code Editor. The File Heirarchy is the smaller column to the left. It displays all of the files that you have created with eclipse. The code editor is the main box to the right. When you create a code file, you will edit the code here.

Image 1


2. Click the "new" button in the top left (the one that looks like a browser window with a star) and select "Java Project" from the drop-down. You will be presented with a Popup for creating a project. All we need to fill out is the name. I'll call mine 'Tutorial' But you can call yours whatever you like.

3. You will see a new folder pop up in the File Hierarchy. Right click it, and select "Properties". Go to http://snadol.com/spigot and download the version of spigot you want to code in. Then, in properties, select "Java Build Path". Select "Add External JARs" and then select the file you've downloaded. Click "Apply and Close".

4. Now, Expand the folder by clicking the little arrow next to it. Right click "src", hover over "new", and then click "Package". A dialog will pop up asking you to name the package. Name it "me.[yourname].[Projectname]", so I'd call mine "me.snadol.Tutorial"

5. Right click the package you just made, hover over new, and select "Class". Name it whatever you want, I name mine "Main", but thats a bad habit. Press enter. You've created your first code document.

6. It has some pre-generated code snippets, and we ned to add onto one of them. Where it says "public class [filename]", add "extends JavaPlugin". This saves a lot of code in the long run. JavaPlugin will be highlited red, hover over it to see the issue. We haven't imported JavaPlugin, so the IDE has no idea what it means. When you hover over it, you'll see that there's a list of fixes below. Click on "Import JavaPlugin".

7. In Minecraft, events get called when different things happen, like when a player breaks a block and such. We're going to use a method to detect when the plugin is enabled. Right under the "public class [filename]", make sure there's an intent, and type "public void onEnable(){" and press enter. Then, we are going to print a message to the console. Type "Bukkit.getLogger().info("Enabled!");". If anything is underlined red, check your spelling, and press CRTL + SHIFT + O to bring up a dialog to import methods, or if there is only one option, to import that. Now when the plugin gets enabled, it will send "Enabled!" to the console.

8. Right click on the "src" folder, hover over new, and select "File". Name it "plugin.yml". Use this example plugin.yml as a starter, and replace all the fields with your info.

Example plugin.yml


8. Right click the plugin folder, click export. In the export file type selector, select Java > JAR File, and click next. Then, where it asks you where to save the file, save it to your desktop. Click export. You've created your first plugin!