Faster Level provider chunk unloading

This commit is contained in:
Shoghi Cervantes 2014-12-07 21:51:32 +01:00
parent 68da4b5b39
commit 9e3d432b9e
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ use pocketmine\Thread;
class CommandReader extends Thread{
private $stream;
public $stream;
/** @var resource */
private $fp;
private $readline;

View File

@ -190,9 +190,9 @@ class McRegion extends BaseLevelProvider{
}
public function unloadChunk($x, $z, $safe = true){
$chunk = $this->getChunk($x, $z, false);
$chunk = isset($this->chunks[$index = Level::chunkHash($x, $z)]) ? $this->chunks[$index] : null;
if($chunk instanceof FullChunk and $chunk->unload(false, $safe)){
unset($this->chunks[Level::chunkHash($x, $z)]);
unset($this->chunks[$index]);
return true;
}