mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-30 07:09:56 +00:00
Anvil garbage collector won't run if not needed
This commit is contained in:
parent
a1a1f1b8e4
commit
f23a05d42e
@ -58,6 +58,7 @@ class RegionLoader{
|
|||||||
|
|
||||||
private function cleanGarbage(){
|
private function cleanGarbage(){
|
||||||
$sectors = array();
|
$sectors = array();
|
||||||
|
$maxSector = 1;
|
||||||
foreach($this->locationTable as $index => $data){ //Calculate file usage
|
foreach($this->locationTable as $index => $data){ //Calculate file usage
|
||||||
if($data[0] === 0 or $data[1] === 0){
|
if($data[0] === 0 or $data[1] === 0){
|
||||||
$this->locationTable[$index] = array(0, 0);
|
$this->locationTable[$index] = array(0, 0);
|
||||||
@ -65,9 +66,16 @@ class RegionLoader{
|
|||||||
}
|
}
|
||||||
for($i = 0; $i < $data[1]; ++$i){
|
for($i = 0; $i < $data[1]; ++$i){
|
||||||
$sectors[$data[0]] = $index;
|
$sectors[$data[0]] = $index;
|
||||||
|
if($data[0] > $maxSector){
|
||||||
|
$maxSector = $data[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(count($sectors) === ($maxSector - 2)){ //No collection needed
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ksort($sectors);
|
ksort($sectors);
|
||||||
$shift = 0;
|
$shift = 0;
|
||||||
$lastSector = 1; //First chunk - 1
|
$lastSector = 1; //First chunk - 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user