Some noob questions...

Discussion in 'Plugin Development' started by 1RV34, Aug 21, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    1RV34

    Well I'm pretty new to Java but I've programmed in some similar languages and would like to try Java too & try to create a little plugin even if it just echo's back a message.

    Some (noobish) questions I already had:
    I've seen stuff like Java, Java SE, Java EE, what's the difference?
    Also on the wiki it said Bukkit uses an older version?
    So what my question basically is, what is the right download I will need to start developing plugins for CraftBukkit?

    And maybe does anyone know a good tutorial for plugins with lots of examples? (I learn best with experimenting on examples, so any example would be really helpful :))

    Very much times thank you if you guys could give me a push in the right direction :)
     
  2. Offline

    JOPHESTUS

  3. Offline

    Sagacious_Zed Bukkit Docs

    Java SE (Standard Edition) is the base Java API. Java ME is the mobile edition and is a reduced subset of SE. Java EE is the enterprise edition and has additional APIs
     
  4. Offline

    1RV34

    I've read through that but that one question still remains: Java or Java EE?

    So you're saying.. Java Se? Thank you :)

    (I thought it would be better to post here again then make a new thread so...)
    I'm getting an error from Eclipse but don't get why.
    and
    It's from this line:
    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
    Why doesn't it recognize the types?
    Note, i do have the latest bukkit library imported & made the class extend JavaPlugin.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  5. Offline

    Sagacious_Zed Bukkit Docs

    Did you save your file? That is needed for the incremental compiler to re verify everything.
     
  6. Offline

    1RV34

    Yes, all the files in the project is saved.

    Edit: I haven't compiled anything yet, Eclipse shows this error in the problems view.
     
  7. Offline

    Sagacious_Zed Bukkit Docs

    The incremental compiler is what is used to check syntax. It is fired automatically. And you are sure Bukkit is on your build path?
     
  8. Offline

    1RV34

    I've done exactly as it says here http://wiki.bukkit.org/Plugin_Tutorial#Reference_the_Bukkit_API
    and my current code looks like
    Code:
    package com.gmail.ricardovermeltfoort.TestPlugin;
     
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class TestPlugin extends JavaPlugin {
    public void onEnable() {
    getLogger().info("TestPlugin has been enabled.");
    }
     
    public void onDisable() {
    getLogger().info("TestPlugin has been disabled.");
    }
     
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if(cmd.getName().equalsIgnoreCase("rvtestplugin")) { // If the player typed /rvtestplugin then do the following...
    // doSomething
    return true;
    } //If this has happened the function will break and return true. if this hasn't happened the a value of false will be returned.
     
    return false;
    }
    }
    
     
  9. Offline

    coldandtired

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
     
  10. Offline

    1RV34

    Thank you... I wonder why the tutorial didn't mention to put those lines in o_o
     
  11. Offline

    coldandtired

    You're going to hit this problem with almost every class you use. Hover your mouse over the red line and a yellow box will appear. On of the options (usually the first one unless it's a common name) will be to import the right namespace automatically.
     
  12. Offline

    Sagacious_Zed Bukkit Docs

    Be aware of importing the wrong class.
     
  13. Offline

    stelar7

    CTRL + SHIFT + O (organize imports) (add used ones, remove unused ones)
    CTRL + SHIFT + F (format file)
    CTRL + SHIFT + S (save all open files)

    The magic combinations
     
  14. Offline

    1RV34

    Thank you for these really helpful tips :p & stelar7 they're truly magical XD
     
Thread Status:
Not open for further replies.

Share This Page