Bukkit 4 Beginners | Tut. 1 - Basic Layout, onEnable, onDisable

Discussion in 'Resources' started by MineStein, May 5, 2014.

?

Was this tutorial helpful?

  1. Yes

    50.0%
  2. No

    50.0%
  3. I have questions (Comment below)

    0 vote(s)
    0.0%
Thread Status:
Not open for further replies.
  1. Offline

    MineStein

    Welcome to "Bukkit 4 Beginners" (Yes, I know about the 4). The aim of this tutorial is to teach you the basics of developing a Bukkit plugin. For this you will need 3 things first:

    1.) CraftBukkit - This is the API that allows you to use Bukkit's resources.

    2.) Eclipse - This is the IDE (Integrated Development Environment) that we will be using. You may also use: Netbeans, IntelliJ, BlueJ, etc.

    3.) Java JDK - This is the developing kit that is required to develop with an IDE and CraftBukkit.

    Ok, so now lets discuss what Java is. Java is an object-oriented programming language. We use Java to create Bukkit. There are other languages, like JavaScript, Python, Ruby, HTML/XHTML, etc. You may need previous experience (Not necessarily in Java).

    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    Begin by creating a new Java Project:

    1) File>New>Java Project
    2) Name it "BukkitTut" (Or whatever you want)
    3) Click ok
    4) Right click on BukkitTut project
    5) Select "Project Properties"
    6) Go to "Java Build Path"
    7) Select the bar "Libraries"
    8) Select the CraftBukkit file you downloaded
    9) Click ok
    10) Right click on the folder "src"
    11) Create a new package
    12) Name it "me.<Your Minecraft Name>.<Your Plugin Name>
    13) Right click on the new package
    14) Create a new class
    15) Name it "Core"
    16) You are done setting this up! It will get really easy and you will be able to do it in under 20 seconds eventually!

    Lets begin coding...

    You should have a bit of code like this
    Code:java
    1. package me.MineStein.BukkitTut;
    2.  
    3. import org.bukkit.plugin.java.JavaPlugin;
    4.  
    5. public class Core extends JavaPlugin{
    6.  
    7. }
    8.  


    So this is the basic part of the code. Lets explain the curly brackets "{" and semicolons ";".
    A { means that (line of code before it), upon being ran, does this (Whatever contained between { and })
    A ; means that it is the of a line of code, the method stops there.

    So for example:
    Code:java
    1. p.sendMessage("Hi");


    Ok, so first thing you will need to add is your onEnable and onDisables. These say that on the plugin being enabled, it does this. On the plugin being disabled, it does this.

    So for the first section, we are going to add two bits of code:

    Code:java
    1. package me.MineStein.BukkitTut;
    2.  
    3. import org.bukkit.plugin.java.JavaPlugin;
    4.  
    5. public class Core extends JavaPlugin{
    6.  
    7. public void onEnable(){
    8.  
    9. }
    10.  
    11. public void onDisable(){
    12.  
    13. }
    14.  
    15. }
    16.  


    These are our onEnable and onDisable statements!
    Simple huh? Well, next time we will learn about Loggers, and our plugin.yml!

    Next Lesson
     
  2. Offline

    raGan.

    CraftBukkit is not an API. CraftBukkit is actually an implementation of an API. Bukkit is an API.

    I'd also like to say that I don't like your tutorial, and I consider it bad for multiple reasons.
    Firstly, people who need to have explained what java is most certainly do not belong to this section. Learning at least basic java before learning how to make plugins is very important. It is unfortunate that there are so many of those who simply don't do that.
    Secondly, it feels like you yourself don't have enough knowledge/experience to create tutorial like that. For example, half of the second part of this tutorial is about bad practice, that should not be taught. (bukkit itself already handles enable/disable messages; not using plugin logger but server logger) I may be wrong, and you may actually be great programmer.
    Another thing to mention would be tutorial starting to explain the most basic terms like java or IDE, then suddenly jumping right into the code, skipping large amounts of information. If I was complete newbie and had no clue about programming, reading this would give me notihng but questions. And instead of answering these questions, next tutorial part is raising even more.

    I really appreciate the effort you put into this and the fact that you do it because you would like to help newcomers, but I would personally not recommend this tutorial to anyone.
    Sorry if this sounded too harsh, I was not trying to offend you in any way, just give you feedback.
     
  3. Offline

    MineStein

    raGan. Ok, thank you for the feedback. I will be removing this shortly, I am taking a break from Bukkit for a while.
     
Thread Status:
Not open for further replies.

Share This Page