mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 06:55:29 +00:00
Tiles and Entities won't get wiped on level unload
This commit is contained in:
parent
38c50c2fec
commit
164b420af6
@ -126,11 +126,12 @@ class LevelAPI{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function unloadLevel(Level $level){
|
||||
public function unloadLevel(Level $level, $force = false){
|
||||
$name = $level->getName();
|
||||
if($name === $this->default){
|
||||
if($name === $this->default and $force !== true){
|
||||
return false;
|
||||
}
|
||||
console("[INFO] Unloading level \"".$name."\"");
|
||||
$level->nextSave = PHP_INT_MAX;
|
||||
$level->save();
|
||||
foreach($this->server->api->player->getAll($level) as $player){
|
||||
@ -219,6 +220,12 @@ class LevelAPI{
|
||||
$level->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
foreach($this->levels as $level){
|
||||
$this->unloadLevel($level, true);
|
||||
}
|
||||
}
|
||||
|
||||
public function getSpawn(){
|
||||
return $this->server->spawn;
|
||||
|
Loading…
x
Reference in New Issue
Block a user