mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 03:08:58 +00:00
Added exception when unloading the default level without switching it first, #3112
This commit is contained in:
parent
1e03c5b795
commit
bdb9b1865b
@ -1015,6 +1015,9 @@ class Server{
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function unloadLevel(Level $level, $forceUnload = false){
|
public function unloadLevel(Level $level, $forceUnload = false){
|
||||||
|
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){
|
if($level->unload($forceUnload) === true){
|
||||||
unset($this->levels[$level->getId()]);
|
unset($this->levels[$level->getId()]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user