Better error message when a level is unloaded during its level tick

Plugins may cause this issue unexpectedly by unloading levels directly during events such as EntityDamageEvent. This adds a better error message to allow developers to understand what is going on and create appropriate workarounds.
This commit is contained in:
Dylan K. Taylor 2017-12-04 10:01:55 +00:00
parent af68125872
commit 990a48d858
2 changed files with 6 additions and 2 deletions

View File

@ -2395,7 +2395,11 @@ class Server{
}
}
}catch(\Throwable $e){
$this->logger->critical($this->getLanguage()->translateString("pocketmine.level.tickError", [$level->getName(), $e->getMessage()]));
if(!$level->isClosed()){
$this->logger->critical($this->getLanguage()->translateString("pocketmine.level.tickError", [$level->getName(), $e->getMessage()]));
}else{
$this->logger->critical($this->getLanguage()->translateString("pocketmine.level.tickUnloadError", [$level->getName()]));
}
$this->logger->logException($e);
}
}

@ -1 +1 @@
Subproject commit a907c227b0801791ec967dbcc240682f0eceec0d
Subproject commit 4b3e289b6b4a9e95e6b6e74deb54e9c933b399de