Blogs Tutorial

Plugin Making Tutorial Basics [Part 1]

  • 394 views 0 today
  • 4
  • 0
Ghost001
Lvl 10Journeyman Explorer
4
Hello everyone, today I am starting a new tutorial, plugin making basics! I'm not an expert myself, but I can easily teach you basic configs, commands, onEnable and onDisable methods, and more! This tutorial is meant for beginners who have no experience with Java, so don't worry!

First, download eclipse and create a new project, package, and class. Also add the latest craftbukkit as an external jar file. Watch this video for help:http://www.youtube.com/watch?v=CrMGokrBHdg

When you first create the new class you'll get something like this:

package me.(your username).(plugin name);

public class Tutorial {

}

In my case it will look like this:

package me.btw001.Tutorial;

public class Tutorial {

}

Now, in this tutorial, I want you guys to learn what everything does and means, so let's get started. You see that ; at the end of "package me.btw001.Tutorial"? That is like a period. Its the end of a statement. You'll learn more about what it does soon.

You see the { brackets? Everything within those brackets will be read. So let's say I did this:

package me.btw001.Tutorial;

public class Tutorial {

}
I am awesome

That code wouldn't be read since it's not in the brackets. So instead lets say I did this:

package me.btw001.Tutorial;

public class Tutorial {
I am awesome
}

That would be read, would it do anything? No. So, lets get started with a basic plugin. First we need to make sure the server knows this is a plugin, so we put "extends JavaPlugin" right next to the plugin name, in this case, Tutorial. It should look like this:

package me.btw001.Tutorial;

public class Tutorial extends JavaPlugin {

}

If you see a red line under it, that's normal. You need to import it! Hover your mouse over the word that's underlined and a yellow box will pop up with a bunch of options. Click on "Import 'JavaPlugin' (org.bukkit.plugin.java)". Whenever you see a red underline like that ever again you want to import it as "org.bukkit. Next we wanna add our onEnable and onDisable methods. Let's do onEnable first. It'll look like this:

package me.btw001.Tutorial;

import org.bukkit.plugin.java.JavaPlugin;

public class Tutorial extends JavaPlugin {

public void onEnable() {

}

}

Simple, right? Now, let's do onDisable. It should look like this:

package me.btw001.Tutorial;

import org.bukkit.plugin.java.JavaPlugin;

public class Tutorial extends JavaPlugin {

public void onEnable() {

}

public void onDisable() {

}

}

That's all for now! Subscribe for more and leave a diamond if you enjoyed.

Suggestions, need help?? Comment below!

More like this

  Have something to say?

Welcome