public void onEnable/Disable errors and more

Discussion in 'Plugin Development' started by EN7, Oct 13, 2014.

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

    EN7

    Hey, I'm new to Java, and I'm using this video tutorial


    However, my current code has some errors, even though I copied exactly what it said to do.
    The annotation @Override is disallowed for this location
    Void is an invalid type for the variable onEnable/onDisable
    My IDE is Eclipse
    My code is:

    package me.EmperorNapoleon7.OnAndOff;

    import org.bukkit.plugin.java.JavaPlugin;

    public class Core extends JavaPlugin {

    @Override
    public void onEnable{}{

    }

    @Override
    public void onDisable{}{

    }

    }

    Except that it is formatted and tabbed, it just messed up on copy paste

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  2. Offline

    fireblast709

    EN7 your method syntax is incorrect
     
  3. Offline

    EN7

    Which means?
     
  4. Offline

    fireblast709

    EN7 that you don't know sufficient Java to start with Bukkit. Even with half an hour of Java experience you should be able to see the mistake.
     
  5. Offline

    JjPwN1

    You don't use curly brackets for methods, instead you need to use parentheses.


    It should be public void onEnable(){ and onDisable(){
     
  6. Offline

    EN7

    :/
    Lol thanks! Useful answer
     
  7. Offline

    eyamaz

    Consider this a site wide warning. If you don't have a constructive thing to say when someone asks for help, just don't post.

    EN7 if you are new to java and want to learn programing, I suggest checking out The New Boston on youtube.
     
  8. Offline

    EN7

    Thanks! I appreciate actually giving me some resources instead of just dismissing me
     
  9. Offline

    Rocoty

    I beg to differ. The New Boston may be a cool dude and all, but at the end of the day he really doesn't teach good Java. I would instead suggest a book like Head First Java or Java for Dummies. One would be much better off.
     
  10. Offline

    eyamaz

    I tend to recommend TNB because it's free. Otherwise I agree, almost any O'Reilly book is good.
     
    Rocoty likes this.
  11. Offline

    Rocoty

    EN7 If you need help with actually learning Java, head over to the Java Ranch forums. They are really helpful over there. Your questions will not go unanswered, for sure.
     
    fireblast709 likes this.
  12. Offline

    EN7

    Thanks
     
  13. Offline

    Eepmageep

    HEYO IT'S MY BRO EN7
     
  14. Offline

    eyamaz

    If you necro another thread today...
     
Thread Status:
Not open for further replies.

Share This Page