205
Hey guys, gabe4356 here, and I will be showing you how to make a bukkit plugin today! Now, I will start off with text tutorials, because, I think it is eaiser to learn from text tutorials rather than video tutorials, but I will be comming out with video tutorials for these as well!
Before we actually get to coding, we will need to setup our workspace, this is the most important part of this, if the workspace is not setup properly, then nothing will work. So, first you will need to download these to get started:
Java 7 JDK: Download here
Eclipse: Download Here
Up to date version of CraftBukkit: Download Here
If you do not know how to install those, you probably shouldn't be trying to learn how to code bukkit plugins. (You do NOT need to install CraftBukkit, as it is not something you install)
Now, open eclipse. You will be welcomed by a warm welcome screen. Kill..I mean close it.
Now you will need to setup The Project, package, and main class.
Step 1: Right click in the left hand side of the screen.
new>Java Project
Name the Project something, in this tutorial, I will be naming it 'Tutorial'
Click Finish
Step 2: Click the arrow next to the Folder you created to the left.
Right click src > New > Package
Name the package something, I wil be naming it "com.gabe" You can name it something like "com.YourName"
Click FInish
Step 3: right click the package you just craeted under 'Src'
New > Class
Name it "MainTutorial" or something like that.
Your class should appear to be this:
Now we need to add the onEnable and onDisable Methods. So just add this:
Now we need to add some imports. You first need to build a path. So Right click on your Tutorial Project.
Build Path > Add External Archives
Now Select the craftBukkit.jar you downloaded earlier
It will appear under "Reference Librarys"
Now, we import the needed imports.
Now, the imports will be highlighted with warnings, because we are not using them. That will fix later.
Now, we need to extend the class to Java Plugin Like this:
Now we need to create the plugin.yml file. This is quite important. It basicly, registers the plugin.
So, right click src > New > File
Name it plugin.yml (MUST BE NAMED plugin.yml !)
Then click Finish. Now this is the code for plugin.yml file:
The name is what shows up when you type /plugins and the main is where the main class is located in the plugin.
So in this cse, it is located in com.gabe.MainTutoiral (MainTutoiral being the class) And the version, well, that is pretty staight forward.
That concludes this tutorial! Note: This plugin will not do anything yet, it is just what we will work with in the next tutorial. I didn't want to make your mind explode :P) I hope this was very helpfull, NOTE: This will be a huge tutorial, I will be adding on more and more.)
Click me to go to next tutorial
Before we actually get to coding, we will need to setup our workspace, this is the most important part of this, if the workspace is not setup properly, then nothing will work. So, first you will need to download these to get started:
Java 7 JDK: Download here
Eclipse: Download Here
Up to date version of CraftBukkit: Download Here
If you do not know how to install those, you probably shouldn't be trying to learn how to code bukkit plugins. (You do NOT need to install CraftBukkit, as it is not something you install)
Now, open eclipse. You will be welcomed by a warm welcome screen. Kill..I mean close it.
Now you will need to setup The Project, package, and main class.
Step 1: Right click in the left hand side of the screen.
new>Java Project
Name the Project something, in this tutorial, I will be naming it 'Tutorial'
Click Finish
Step 2: Click the arrow next to the Folder you created to the left.
Right click src > New > Package
Name the package something, I wil be naming it "com.gabe" You can name it something like "com.YourName"
Click FInish
Step 3: right click the package you just craeted under 'Src'
New > Class
Name it "MainTutorial" or something like that.
Your class should appear to be this:
Code
package com.gabe;
public class MainTutorial {
}
public class MainTutorial {
}
Now we need to add the onEnable and onDisable Methods. So just add this:
Code - onEnable onDisable
package com.gabe;
public class MainTutorial {
public void onDisable() {
//On Disable method stub
}
public void onEnable() {
//on Enable Method stub
{
}
}
}
public class MainTutorial {
public void onDisable() {
//On Disable method stub
}
public void onEnable() {
//on Enable Method stub
{
}
}
}
Now we need to add some imports. You first need to build a path. So Right click on your Tutorial Project.
Build Path > Add External Archives
Now Select the craftBukkit.jar you downloaded earlier
It will appear under "Reference Librarys"
Now, we import the needed imports.
Code - Imports
package com.gabe;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class MainTutorial {
public void onDisable() {
//On Disable method stub
}
public void onEnable() {
//on Enable Method stub
{
}
}
}
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class MainTutorial {
public void onDisable() {
//On Disable method stub
}
public void onEnable() {
//on Enable Method stub
{
}
}
}
Now, the imports will be highlighted with warnings, because we are not using them. That will fix later.
Now, we need to extend the class to Java Plugin Like this:
Code - Java Plugin
package com.gabe;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class MainTutorial extends JavaPlugin {
public void onDisable() {
//On Disable method stub
}
public void onEnable() {
//on Enable Method stub
{
}
}
}
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class MainTutorial extends JavaPlugin {
public void onDisable() {
//On Disable method stub
}
public void onEnable() {
//on Enable Method stub
{
}
}
}
Now we need to create the plugin.yml file. This is quite important. It basicly, registers the plugin.
So, right click src > New > File
Name it plugin.yml (MUST BE NAMED plugin.yml !)
Then click Finish. Now this is the code for plugin.yml file:
Code - Plugin.yml
name: Tutorial
main: com.gabe.MainTutorial
version: 1.0
main: com.gabe.MainTutorial
version: 1.0
So in this cse, it is located in com.gabe.MainTutoiral (MainTutoiral being the class) And the version, well, that is pretty staight forward.
That concludes this tutorial! Note: This plugin will not do anything yet, it is just what we will work with in the next tutorial. I didn't want to make your mind explode :P) I hope this was very helpfull, NOTE: This will be a huge tutorial, I will be adding on more and more.)
Click me to go to next tutorial
Tags |
tools/tracking
2855595
6
creating-bukkit-plugins-part-1---setting-up-your-workspace
Create an account or sign in to comment.
Cheseari Will not Obey The Daleks!
|
|
V
Î〈•…•〉Ì