Solved onDisable() called before onEnable()??

Discussion in 'Spigot Plugin Development' started by Sulphate, May 14, 2017.

  1. Hello all,

    Just updating one of my plugins, but for some really strange reason, onDisable() is being called before onEnable(), causing NullPointerErrors as objects referenced haven't even been created yet.

    There's no point in me putting code in here, I never disable the plugin at any point.

    Any help appreciated.
     
  2. On reload your plugin is disabled then your plugin is enabled

    onDisable()
    onEnable()

    Anyway, when the server starts only onEnable() is called so you must be not setting the reference variable correctly if it is null

    CMA we see your code
     
    • Agree Agree x 3
  3. Mas

    Mas

    As stated above, this happens because you are reloading the server.
    This is exactly the reason why you shouldn't use /reload, but instead restart your server.
     
  4. Ahhh of course, I'm missing the obvious as per usual. Thanks!
     
    • Like Like x 1