mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
fixed tileentities getting resetted when unloading level
This commit is contained in:
parent
8b77b88e84
commit
9d82e28297
2 changed files with 12 additions and 14 deletions
|
|
@ -72,9 +72,20 @@ class Level{
|
|||
public function close(){
|
||||
if(isset($this->level)){
|
||||
$this->save(true, true, true, true);
|
||||
$this->server->api->block->removeAllBlockUpdates($this);
|
||||
foreach($this->server->api->player->getAll($this) as $player){
|
||||
$player->teleport($this->server->spawn);
|
||||
}
|
||||
foreach($this->entityList as $entity){
|
||||
if($entity->class !== ENTITY_PLAYER){
|
||||
$entity->close();
|
||||
}
|
||||
}
|
||||
foreach($this->server->api->tile->getAll($this) as $tile){
|
||||
$tile->close();
|
||||
}
|
||||
$this->level->close();
|
||||
unset($this->level);
|
||||
$this->server->api->block->removeAllBlockUpdates($this);
|
||||
}
|
||||
unset($this->mobSpawner->level);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue