Fixed Level->getMetadata() and similar, removed extra references

This commit is contained in:
Shoghi Cervantes 2014-10-19 19:51:36 +02:00
parent 34946faf94
commit f2b573c32f
3 changed files with 17 additions and 6 deletions

View File

@ -307,8 +307,15 @@ class Level implements ChunkManager, Metadatable{
if($this->getAutoSave()){
$this->save();
}
$this->unloadChunks();
foreach($this->chunks as $chunk){
$this->unloadChunk($chunk->getX(), $chunk->getZ(), false);
}
$this->server->getGenerationManager()->closeLevel($this);
$this->provider->close();
$this->provider = null;
$this->blockMetadata = null;
}
/**
@ -355,11 +362,13 @@ class Level implements ChunkManager, Metadatable{
$player->teleport($this->server->getDefaultLevel()->getSafeSpawn());
}
}
$this->close();
if($this === $defaultLevel){
$this->server->setDefaultLevel(null);
}
$this->close();
return true;
}
@ -2071,18 +2080,18 @@ class Level implements ChunkManager, Metadatable{
}
public function setMetadata($metadataKey, MetadataValue $metadataValue){
$this->server->getPlayerMetadata()->setMetadata($this, $metadataKey, $metadataValue);
$this->server->getLevelMetadata()->setMetadata($this, $metadataKey, $metadataValue);
}
public function getMetadata($metadataKey){
return $this->server->getPlayerMetadata()->getMetadata($this, $metadataKey);
return $this->server->getLevelMetadata()->getMetadata($this, $metadataKey);
}
public function hasMetadata($metadataKey){
return $this->server->getPlayerMetadata()->hasMetadata($this, $metadataKey);
return $this->server->getLevelMetadata()->hasMetadata($this, $metadataKey);
}
public function removeMetadata($metadataKey, Plugin $plugin){
$this->server->getPlayerMetadata()->removeMetadata($this, $metadataKey, $plugin);
$this->server->getLevelMetadata()->removeMetadata($this, $metadataKey, $plugin);
}
}

View File

@ -299,5 +299,6 @@ class McRegion extends BaseLevelProvider{
$region->close();
unset($this->regions[$index]);
}
$this->level = null;
}
}

View File

@ -198,6 +198,7 @@ class RegionLoader{
public function close(){
$this->writeLocationTable();
fclose($this->filePointer);
$this->levelProvider = null;
}
public function doSlowCleanUp(){