Minecraft Blogs / Tutorial

[Bukkit] How to make Your Very First Plugin!

  • 498 views, 1 today
  • 4
  • 2
  • 3
Bukkit Dev's Avatar Bukkit Dev
Level 2 : Apprentice Miner
4
Hello Minecrafters, This is Bukkit Dev.

Today we are Gonna show you how to make your Very First Plugin.

Hi Guys!Have you ever Dreamed of Becoming a Coder and Making Bukkit Plugins? Well i am about to teach you how to make a Very Simple Bukkit Plugin!In this tutorial i will be using Eclipse which can be Downloaded ateclipse.organd also the Latest Bukkit Beta Build which can be Downloaded atdl.bukkit.org.Step 1: Download Eclipse and be Sure to Download the Eclipse IDE for Java Developers. Eclipse can be Downloaded from the Followingeclipse.org.Step 2: Open Eclipse once you have Downloaded it and Select a Directory for Your Workspace (It will be used to save your .java Files and Plugin Files)Step 3: Download the Latest Bukkit Beta Build which can be Found atdl.bukkit.orgStep 4. Once it has Downloaded, Goto Eclipse and Right Click in Package Explorer and goto New. Then click Java Project and Where it says Project Name, Enter your Plugin Name then Click Finish.Step 5: Now your Plugin Java Project should be Created and if it is then you will see a Folder which is called (Your Plugin Name). Now Right Click (Your Plugin Name) and goto New then Package. Now Enter a Package Name, For Example com.example.example and click Finish.Step 6: Now you should see a Package with the Name you gave it. Right click the Package and goto New then Java Class. Enter a Name for it which should be Main and hit Finish and a Window with Text should appear. You are now ready to Program.Step 7: Right Click the Project you Made and goto Build Path then Configure Build Path. You should see a Few Tabs at the Top. Choose the Libraries Tab, Now click add External Jars and find your Bukkit Beta Build. Hit Open. It should then appear so hit Ok and goto the Window with Text.Step 8: You will see this Code:package com.craftland.crafthelpme;public class Main extends JavaPlugin {}So what you want to do is go in between { and } then type inpublic void onEnable(){}and you will see a Green Arrow so if you Hover over it. It will show something like this Overrides ...So don't be alarmed as that is Normal. Now what you want to do is type inpublic void onDisable(){}after } on onEnable.(Optional) Step 9: If you want a Plugin Config then put getConfig().options.copyDefaults(true); in onEnable in between { and } so that means that it is going to generate a Config which i explain in a Future Step. In onDisable type in saveConfig(); so it will save the Config when you Modify it on your Server once you Upload the Plugin.Step 10: Our code will now need a onCommand Boolean which means when we type a Command that we make up. It understands it and does what its code is. So type inpublic boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){return false;}Once you have done that Hover over the Red Lines and click Import ...After you have done that type in Player player = (Player)sender; and once again hover over the Red Line and click Import ...Step 11: It is time to make our first Command so just copy this code and Paste it in between Player player = (Player)sender; and return false; type inif(commandLabel.equalsIgnoreCase("test")){player.sendMessage("Test!");}So once you have done that, You have made your first command but not the Plugin yet. So after you finish typing all that in Save the Project by Clicking Save in the Toolbar.Step 12: Now it's time to make the plugin.yml file. It's important so listen carefully. Firstly create the file by right clicking the Project, Hovering over New and clicking File. Name the File plugin.yml and hit Finish and Now a Blank Text Window should appear. Type in the followingname: (Plugin Name)main: (package name has to be com.example) and your Class File name which should be Main like this e.g. com.example.Mainversion: (Version Number)author: (Creator of the Plugin)description: > Description of the Plugin!commands:(command name no spaces) description: (Command Description)Once you have written that down. Your bukkit plugin is Ready! So Right Click your Project and click Export. Now Select a Location for your Plugin.jar to be Saved and Call it what ever you like but make sure .jar is at the end. And hit Finish. If you have made a Config then goto Step 13 and don't export your Plugin Yet!(Config Only)Step 13: If you have made a Config Generated Plugin then make a New File and call it config.yml and once you have done that feel free to enter anything but i am not going to be Talking about Configs in this Tutorial. If you want to learn how to make a Config Related Plugin then Click Here (Coming Soon). So once you have entered something into your Config feel free to Export your Plugin.If your plugin works in-game then Congratulations! If it dosen't please post the Error you get on the Console. Be sure to put the .jar Plugin File in your Plugins Folder.Thanks for Reading, I hope to publish more Tutorials like this in the Future
Tags

Create an account or sign in to comment.

1
10/09/2013 12:51 am
Level 13 : Journeyman Skinner
ki11bud
ki11bud's Avatar
Please add paragraphs...I just get lost and give up xD
1
10/08/2013 8:29 am
Level 6 : Apprentice Crafter
ahmedmfadhly
ahmedmfadhly's Avatar
this looks helpfull keep it up
1
10/08/2013 8:18 am
Level 7 : Apprentice Network
h3r08r1n3mc
h3r08r1n3mc's Avatar
Check your spelling, grammar, paragraphs and punctuation
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome