mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Fixed #1578 Chunk garbage collection not marking chunks as unused
This commit is contained in:
parent
5b69f07a55
commit
0251ae93d8
@ -450,17 +450,6 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$this->processChunkRequest();
|
$this->processChunkRequest();
|
||||||
|
|
||||||
if($this->nextSave < microtime(true)){
|
if($this->nextSave < microtime(true)){
|
||||||
$X = null;
|
|
||||||
$Z = null;
|
|
||||||
foreach($this->usedChunks as $i => $c){
|
|
||||||
if(count($c) === 0){
|
|
||||||
unset($this->usedChunks[$i]);
|
|
||||||
Level::getXZ($i, $X, $Z);
|
|
||||||
if(!$this->isSpawnChunk($X, $Z)){
|
|
||||||
$this->unloadChunkRequest($X, $Z, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->save(false);
|
$this->save(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1462,7 +1451,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isChunkInUse($x, $z){
|
public function isChunkInUse($x, $z){
|
||||||
return isset($this->usedChunks[static::chunkHash($x, $z)]);
|
return isset($this->usedChunks[static::chunkHash($x, $z)]) and count($this->usedChunks[static::chunkHash($x, $z)]) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1679,6 +1668,18 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function doChunkGarbageCollection(){
|
public function doChunkGarbageCollection(){
|
||||||
|
$X = null;
|
||||||
|
$Z = null;
|
||||||
|
foreach($this->usedChunks as $i => $c){
|
||||||
|
if(count($c) === 0){
|
||||||
|
unset($this->usedChunks[$i]);
|
||||||
|
Level::getXZ($i, $X, $Z);
|
||||||
|
if(!$this->isSpawnChunk($X, $Z)){
|
||||||
|
$this->unloadChunkRequest($X, $Z, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(count($this->unloadQueue) > 0){
|
if(count($this->unloadQueue) > 0){
|
||||||
foreach($this->unloadQueue as $index => $chunk){
|
foreach($this->unloadQueue as $index => $chunk){
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user