Added small things

This commit is contained in:
Shoghi Cervantes
2014-07-12 19:27:51 +02:00
parent 9a4ead54e3
commit a7944502cd
6 changed files with 56 additions and 8 deletions

View File

@ -130,8 +130,8 @@ class Anvil extends BaseLevelProvider{
}
public function unloadChunk($x, $z, $safe = true){
$chunk = $this->getChunk($x, $z, false);
if($safe === true and $this->isChunkLoaded($x, $z)){
$chunk = $this->getChunk($x, $z);
foreach($chunk->getEntities() as $entity){
if($entity instanceof Player){
return false;
@ -139,7 +139,17 @@ class Anvil extends BaseLevelProvider{
}
}
unset($this->chunks[Level::chunkHash($x, $z)]);
foreach($chunk->getEntities() as $entity){
$entity->close();
}
foreach($chunk->getTiles() as $tile){
$tile->close();
}
$this->chunks[$index = Level::chunkHash($x, $z)] = null;
unset($this->chunks[$index]);
return true;
}