mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Fixed plugins causing crashes by using Level->unload() and add a warning
yes, we don't want you to use this, but it still shouldn't crash if it can be prevented...
This commit is contained in:
@ -983,13 +983,16 @@ class Server{
|
||||
if($level === $this->getDefaultLevel() and !$forceUnload){
|
||||
throw new \InvalidStateException("The default level cannot be unloaded while running, please switch levels.");
|
||||
}
|
||||
if($level->unload($forceUnload) === true){
|
||||
unset($this->levels[$level->getId()]);
|
||||
|
||||
return true;
|
||||
}
|
||||
return $level->unload($forceUnload);
|
||||
}
|
||||
|
||||
return false;
|
||||
/**
|
||||
* @internal
|
||||
* @param Level $level
|
||||
*/
|
||||
public function removeLevel(Level $level) : void{
|
||||
unset($this->levels[$level->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user