onDisable not working?

Discussion in 'Plugin Development' started by Jinux, Jan 20, 2011.

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

    Jinux

    Hi guys, so I'm trying to write to a file when the server gets shutdown but it seems my onDisable() function isn't getting called? I'd be very grateful of a second pair of eyes!
    Code:
     public void onDisable() {
            timeOff = new Date();
               try{
                   try{
                       final Formatter file = new Formatter(time_file);
                    file.format("%s", timeOff.toString());
                    file.close();
                    System.out.println("Hello");
                   }
                catch(IOException i){
                    System.out.println(i);
                }
               }
               catch(Exception e){
                   System.out.println(e);
               }
        }
     
  2. Offline

    MysticX

  3. Offline

    Jinux

    Seriously? That breaks my whole bloody plugin [​IMG]

    Can I vote that bug up or something?
     
  4. ondisable is called when getPluginLoader().disablePlugin(pluginObject) is called.
    so it is called when you deactivate the plugin without shuting down the server.
     
  5. Offline

    Jinux

    Yeah the problem is, I need to process some stuff when the server goes down, not just when the plugin is disabled.
     
  6. try overwriting finalize() this might just work for you :)
     
  7. Offline

    Jinux

    Could you explain how?
     
  8. Offline

    tkelly

    @Affecting_Nelas : Nope. Tried that xD

    Jinux, if you comment on the ticket, it could bring more attention to it.
     
  9. Offline

    Jinux

    Done now. I would have before hand but I couldn't figure out how to comment it. Then I realised this morning that it was a separate account :p
     
Thread Status:
Not open for further replies.

Share This Page