Solved PLUGIN STOPPED WORKING ARGGGGG!!!

Discussion in 'Plugin Development' started by Bobfan, Nov 23, 2012.

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

    Bobfan

    IT JUST STOPPED WORKING AND I DON'T KNOW WHY!?!?
    Code:
    public void onEnable() {
            QuestMaker qM = new QuestMaker(this);
            QuestLocater qL = new QuestLocater(this);
            RacePlay rP = new RacePlay(this);
            RaceJoin rJ = new RaceJoin(this);
            getServer().getPluginManager().registerEvents(qM, this);
            getServer().getPluginManager().registerEvents(qL, this);
            getServer().getPluginManager().registerEvents(rP, this);
            getCommand("NewQuest").setExecutor(qM);
            getCommand("ReloadConfig").setExecutor(qM);
            getCommand("RaceJoin").setExecutor(rJ);
            getCommand("RaceInfo").setExecutor(rJ);
    This is in my main class, once I added the RacePlay thing, it just all of a sudden stopped everything. Even my commands for my rJ class have stopped working and I have no idea why?
     
  2. Offline

    Sagacious_Zed Bukkit Docs

    What leads you to believe it stopped working? Entire stack traces please.
     
  3. Offline

    fireblast709

    moreover, post your RacePlay class, as you probably get a line in your stacktrace like:
    Code:
    [package].RacePlay.<init>(RacePlay.java: line)
     
  4. Offline

    Bobfan

    That's what I don't know. I was doing some tests, forgot I wasn't registering the events in RacePlay. I added that in, it said I had to implement listener, so i click ok in eclipse, than i went to test it, and boom, it doesn't work. EVERY COMMAND AND EVENT DOESN'T WORK! Has this happened to anyone else?
    edit:
    Code:
    public class RacePlay implements Listener {
     
        private Plugin pp;
        public RacePlay(Plugin p2) {this.pp = p2;}
        FileConfiguration c = pp.getConfig();
     
        @EventHandler
        public void onAttack(EntityDamageByEntityEvent event) {//Attack Event
     
    public class RaceJoin implements CommandExecutor {
     
        private Plugin pp;
        Player p;
        public RaceJoin(Plugin p2) {this.pp = p2;}
     
        public boolean onCommand(CommandSender sender1, Command command, String commandLabel, String[] args) {
     
    public class QuestLocater implements Listener {
     
        private Plugin pp;
        public QuestLocater(Plugin p2) {this.pp = p2;}
     
        @SuppressWarnings("deprecation")
        @EventHandler
        public void onInteractEvent(PlayerInteractEvent event) {//click event
     
    @SuppressWarnings("unused")
    public class QuestMaker implements Listener, CommandExecutor {
     
        private Plugin pp;
        public QuestMaker(Plugin p2) {this.pp = p2;}
     
        public boolean onCommand(CommandSender sender1, Command command, String commandLabel, String[] args) {//command
    That is the beginning of all other classes

    edit edit: how do you get a stack trace?
     
  5. Offline

    ZeusAllMighty11

    You put an eventhandler before a class definition..

    What are you doing, dude. Don't scream it doesn't work if your code is this messy... Start a new class, and remake them. Clean it up a bit...I can't see what you are doing.
     
  6. Offline

    Bobfan

    I already re-made one of my classes to cleaned it up. I'm just angry cause I thought I'd finish tonight. I still don't know what stack trace is, I'm "New" to Java, but I've done it long enough to pick up things. (I'm also tired) It was working fine, (Everything other than my RacePlay, cause I forgot to register the event handlers) till I tried to register the event handlers (There are more than 1) from my RacePlay class and the whole thing stopped).

    edit: If I stop implementing that class, everything goes fine, I think there is a problem with that code.
     
  7. Offline

    CubieX

    A stack trace is the error message your bukkit server console will emit, when your plugin causes errors or raises exceptions.
    Usually a dozen or more lines where JAVA tells you, what went wrong (e.g. "MyFancyPlugin caused a NullPointerException") and most of the time also which methods were called and in wich line of code the error occured.
    So this can help a developer to figure out quickly where and why there was an error.

    Your above posted code is a structural mess. You should probably use separate .java files for your command handler methods and for every class definition.
    Also, it's a good idea not to use different parenthesis layouts, but stick with one.
    Personally, I find it best, to have the beginning and the ending parenthesis on the same indentation level.
    Keep your code clean and well structured. It's worth it.
     
    Bobfan likes this.
  8. Offline

    Bobfan

    That's kind of what I thought for the event handlers. Also, it shows no errors when you try to do anything, it just doesn't work.

    edit: My bad, it shows it qwhen being enabled, I missed it because I thought it was another plugin I had but didn't delete. Sorry for wasting everyone's times.
    Line 37
    Code:
    public void onEnable() {
            QuestMaker qM = new QuestMaker(this);
            QuestLocater qL = new QuestLocater(this);
            RacePlay1 rP1 = new RacePlay1(this);//<-------
            RacePlay2 rP2 = new RacePlay2(this);
            RacePlay3 rP3 = new RacePlay3(this);
            RaceJoin rJ = new RaceJoin(this);
           
            getServer().getPluginManager().registerEvents(qM, this);
            getServer().getPluginManager().registerEvents(qL, this);
            getServer().getPluginManager().registerEvents(rP1, this);
            getServer().getPluginManager().registerEvents(rP2, this);
            getServer().getPluginManager().registerEvents(rP3, this);
           
            getCommand("NewQuest").setExecutor(qM);
            getCommand("ReloadConfig").setExecutor(qM);   
            getCommand("RaceJoin").setExecutor(rJ);
            getCommand("RaceInfo").setExecutor(rJ);    
     
  9. the problem is caused inside the raceplay on line 33
     
  10. Offline

    Bobfan

    WOOPS! When did I type all of this? I see now, I accidentally put the config outside the event instead of inside the event. Looking back at all the other code, it was inside the event, but this one time I put it outside. Now fixed, no errors on load...(Deleated error filled plugin) but now in some of the code, must fix. Ty
     
Thread Status:
Not open for further replies.

Share This Page