Minecraft Blogs / Tutorial

Learn To Code | Bukkit Plugins | Getting Set Up | #1

  • 2,027 views, 2 today
  • 23
  • 12
  • 14
SleepyDog's Avatar SleepyDog
Level 37 : Artisan Button Pusher
105
undefined
Always wanted to code? Always wanted them simple plugins that make your server unique and give it the custom look?
Over the next few months i will be creating easy to follow totorials on the development of a bukkit plugin. You will be able to message me for help. Comment ideas and suggestions and learn how to create your own bukkit/spigot plugin for your own custom server!


Part two is live: Click here (After reading below first!)

undefined
As most would know, you need to download some software to start developing your own software. Not all people prefer it but i will be using Eclipse Classic for my tutorials. 

So the forst step is to hop over to their website and download the software. (Click To Download)
I would reccomend you install and run the program before continuing.

Secondaly you need to be able to code them flashy bukkit plugins! To do this you need to downlaod the bukkit API. Bukkit just allowed external downloads so here is the 1.7.10 API (Click To Download)

And that's it! You now have everything you need to create a bukkit plugin! 

I would also reccomend making a plugin test server. Plugins are not always perfect and you will make mistakes. Don't try your plugin in a running public server!

Sadly i cant link you to a download of the bukkit server due to a DMCA takedown request. You can ask around if you dont have the official version. You may be linked to an ALT download. (Not reccomended)

undefined
When you download Eclipse you will be greeted by a rather empty screen. As i have installed it before i cant show you this. However you know you have never made anything so something will be there.

Firstly you need to create a 'Project'. This will be the main folder of the plugin and will store everything.

To do this click File>New>JavaProject.
undefined

When naming the project it need to be related to the plugin. In this case we will make a custom help menu.
undefined
Then click finish and you are done!
undefined
You project will then be listed at the side of the screen.
undefined
undefined
Packages are the first component of the plugin.
To create a package click on the project you ject created and goto. File>New>Package.
undefined
When you name the package you need to follow a strict format. The standerd for bukkit plugins is:
me.<Your Minecraft Name>
undefined
When you have done this simply click Finish.

undefined
After this an 'Empty' package will appear.
undefined
undefined
Classes are the final storage place of the plugin. The class is the place that stored the code. Essentialy the most inportant bit. To create the class you click on the package and goto File>New>Class.
undefined
The name for the class is less important. The name must start with a capital letter. It will usaly be other the name of the plugin or in this case, you simply call it 'Main'. This is your main class.
undefined

Again simply click finish.
undefined
You will see the main class appear in the package and a nice bit of starter code for you.
undefined

undefined
The build path of a plugin is basicly the main code of bukkit. You use the code to tell the API to tell the server to do something. It also works the other way around. The server calls the API which tells the plugin some information, you can then act apon that data. Anyway keeping it simple, the API is the link between the plugin and the server.

To start you need to configure the build path.
Right click on the project and goto Build_Path>Configure_Build_Path
undefined
This is where that bukkit API you downloaded comes in.
when the window comes up, click 'Add external jars' and find the API you downloaded.
undefined
When you find it select the jar and click open. (This will not run the jar)
undefined
When simply click 'Okay' and the build path is complete!
undefined
undefined
In this tutorial i am only going to show yoo to get the basics of the plugin. As this is getting really long i will release #2 tomorow (Not Uploaded) showing you how to get a basic plugin to work ingame. Before you leave here is some essential code you will need for the next tutorial.


Firstly add 'extends JavaPlugin' between the words 'Main' and the bracket '{' this tells the API it is a plugin.
undefined
Then you need to import 'JavaPlugin'
undefined
This fixes the error as the plugin now knows what JavaPlugin is/means.

Thankyou for reading, #2 will be out 11/12/2014. Check back soon!
undefined
| Part Two |  <<Click here!












Tags

2 Update Logs

Part Two Is Out : by SleepyDog 11/12/2014 11:49:55 amNov 12th, 2014

LOAD MORE LOGS

Create an account or sign in to comment.

1
04/11/2016 3:15 pm
Level 2 : Apprentice Network
superfastiggy
superfastiggy's Avatar
1
01/01/2015 3:51 pm
Level 23 : Expert Modder
MineStein
MineStein's Avatar
Don't try and teach if you have no idea what you are teaching. 'extends JavaPlugin' is making the class a child of the JavaPlugin class in Bukkit's API.
1
01/18/2015 11:58 am
Level 37 : Artisan Button Pusher
SleepyDog
SleepyDog's Avatar
I know what it means, the whole idea of this is so that anyone can make a simple plugin.
1
02/04/2015 10:05 pm
Level 23 : Expert Modder
MineStein
MineStein's Avatar
You're attempting to teach people, and I can respect that. I will not, however pretend the code you have written is the best way to do it. If you want to teach others, make sure you have enough practice and experience. Otherwise, you corrupt other people's learning.
1
11/17/2014 5:09 am
Level 43 : Master Pokemon
Jacob Rigoberto
Jacob Rigoberto's Avatar
I hope you can help me further, as I can't make more than a hello world script in JavaScript now :V


console.log("Hello World!");
1
11/17/2014 10:44 am
Level 37 : Artisan Button Pusher
SleepyDog
SleepyDog's Avatar
Yes i will make more, i was waiting for someone to request it. There are other things you can do, like permissions. 
If you would like faster help go to forums.bukkit.org. They will help you, this has got you an understanding of how to create a simple command and reply plugin, now you can work towards better things.

For permissions: if(cmd.getName().equalsIgnoreCase("website") && sender.hasPermission("website.test")) {

sender.sendMessage("The website is www.example.com");

}
1
11/13/2014 1:22 pm
Level 20 : Expert Pokemon
GamingAleks
GamingAleks's Avatar
Thank you for this very helpful blog :)
1
11/13/2014 1:25 pm
Level 37 : Artisan Button Pusher
SleepyDog
SleepyDog's Avatar
Not a problem. Version #1 and #2 are out. In the next ones you will learn how to code and export the plugin. Use the links at the bottom of the blog.
1
11/11/2014 11:42 pm
Level 20 : Expert Button Pusher
MinoOtter
MinoOtter's Avatar
dis is really nice of u but theres a problem .... people needa learn how to do more things b4 they can actually code their own plugin. sorry for being such a critic :P
1
11/12/2014 3:10 am
Level 37 : Artisan Button Pusher
SleepyDog
SleepyDog's Avatar
This is #1 just getting set up. The plugin code will be later tonight.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome