1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Detecting when the server is shutting down from a plugin

Discussion in 'Resources' started by dktapps, Jul 21, 2017.

  1. dktapps

    dktapps A-Team Staff Member PMMP Team

    Messages:
    365
    GitHub:
    dktapps
    This is far easier than most people believe. No need for any events, simply

    Code:
    public function onDisable(){
        if(!$this->getServer()->isRunning()){
            //do things on server shutdown
        }else{
            //reload, plugin disabled or server crashed
        }
    }
    
    in your PluginBase.

    Do note however that this will not work in the event of a server crash, as the server is still judged to be "running" if it did not shut down correctly.
     
  2. Levi

    Levi Baby Zombie

    Messages:
    189
    how do you get Player on onDisable()?
     
  3. TheDeibo

    TheDeibo Zombie Poggit Reviewer Verified

    Messages:
    217
    GitHub:
    thedeibo
    Please explain what you mean, as I am unsure what you mean.
     
  4. Levi

    Levi Baby Zombie

    Messages:
    189
    so, I want to transfer the player to a different server when my server shut down but I don't know how to get the Player
     
  5. TheDeibo

    TheDeibo Zombie Poggit Reviewer Verified

    Messages:
    217
    GitHub:
    thedeibo
    That is a completely different topic to what dktapps has started.
    Please create that topic separately , as it helps for another user to search for the same issue as you.
     
    SOFe, iiFlamiinBlaze and Thunder33345 like this.

Share This Page