diff --git a/src/pmf/PMFLevel.php b/src/pmf/PMFLevel.php index 74de7391dc..a64d64f936 100644 --- a/src/pmf/PMFLevel.php +++ b/src/pmf/PMFLevel.php @@ -186,12 +186,19 @@ class PMFLevel extends PMF{ if(!file_exists(dirname($path))){ @mkdir(dirname($path), 0755); } - $this->isGenerating = true; - $this->initCleanChunk($X, $Z); - $ret = $this->level->generateChunk($X, $Z); - $ret = $ret and $this->level->populateChunk($X, $Z); - $this->saveChunk($X, $Z); - $this->isGenerating = false; + if($this->isGenerating === false){ + $this->isGenerating = true; + $this->initCleanChunk($X, $Z); + $ret = $this->level->generateChunk($X, $Z); + $ret = $ret and $this->level->populateChunk($X, $Z); + $this->saveChunk($X, $Z); + $this->isGenerating = false; + }else{ + $this->initCleanChunk($X, $Z); + $ret = $this->level->generateChunk($X, $Z); + $ret = $ret and $this->level->populateChunk($X, $Z); + $this->saveChunk($X, $Z); + } return $ret; } @@ -213,9 +220,13 @@ class PMFLevel extends PMF{ } if($this->isGenerating === false and !$this->isPopulated($X, $Z)){ - $this->isGenerating = true; - $ret = $this->level->populateChunk($X, $Z); - $this->isGenerating = false; + if($this->isGenerating === false){ + $this->isGenerating = true; + $this->level->populateChunk($X, $Z); + $this->isGenerating = false; + }else{ + $this->level->populateChunk($X, $Z); + } } $chunk = @gzopen($path, "rb"); diff --git a/src/world/Level.php b/src/world/Level.php index f20c090680..fb6beb6a8b 100644 --- a/src/world/Level.php +++ b/src/world/Level.php @@ -107,7 +107,6 @@ class Level{ if($this->level->isGenerating === false and count($this->changedCount) > 0){ arsort($this->changedCount); - $resendChunks = array(); foreach($this->changedCount as $index => $count){ if($count < 582){//Optimal value, calculated using the relation between minichunks and single packets break;