fixed crash on dev build self-shutdown

This commit is contained in:
Dylan K. Taylor 2019-01-22 13:38:50 +00:00
parent 48a99937b9
commit 1ebc101ded

View File

@ -1710,10 +1710,12 @@ class Server{
$player->close($player->getLeaveMessage(), $this->getProperty("settings.shutdown-message", "Server closed")); $player->close($player->getLeaveMessage(), $this->getProperty("settings.shutdown-message", "Server closed"));
} }
if($this->levelManager instanceof LevelManager){
$this->getLogger()->debug("Unloading all levels"); $this->getLogger()->debug("Unloading all levels");
foreach($this->levelManager->getLevels() as $level){ foreach($this->levelManager->getLevels() as $level){
$this->levelManager->unloadLevel($level, true); $this->levelManager->unloadLevel($level, true);
} }
}
$this->getLogger()->debug("Removing event handlers"); $this->getLogger()->debug("Removing event handlers");
HandlerList::unregisterAll(); HandlerList::unregisterAll();