mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 08:39:53 +00:00
small things
This commit is contained in:
parent
9301c04e1f
commit
d699a97bb7
@ -210,8 +210,8 @@ class Player{
|
||||
|
||||
$c = key($this->chunksOrder);
|
||||
$d = @$this->chunksOrder[$c];
|
||||
if($c === null){
|
||||
$this->server->schedule(50, array($this, "getNextChunk"));
|
||||
if($c === null or $d === null){
|
||||
$this->server->schedule(40, array($this, "getNextChunk"));
|
||||
return false;
|
||||
}
|
||||
unset($this->chunksOrder[$c]);
|
||||
|
@ -218,20 +218,19 @@ class PMFLevel extends PMF{
|
||||
}
|
||||
|
||||
public function loadChunk($X, $Z){
|
||||
$X = (int) $X;
|
||||
$Z = (int) $Z;
|
||||
$index = self::getIndex($X, $Z);
|
||||
if($this->isChunkLoaded($X, $Z)){
|
||||
return true;
|
||||
}
|
||||
$index = self::getIndex($X, $Z);
|
||||
$path = $this->getChunkPath($X, $Z);
|
||||
if(!file_exists($path)){
|
||||
if($this->generateChunk($X, $Z) === false){
|
||||
return false;
|
||||
}elseif($this->isGenerating === 0){
|
||||
$this->populateChunk($X, $Z);
|
||||
return true;
|
||||
}
|
||||
if($this->isGenerating === 0){
|
||||
$this->populateChunk($X, $Z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$chunk = @gzopen($path, "rb");
|
||||
|
@ -77,6 +77,10 @@ class Level{
|
||||
unset($this->usedChunks[$X.".".$Z][$player->CID]);
|
||||
}
|
||||
|
||||
public function isChunkPopulated($X, $Z){
|
||||
return $this->level->isPopulated($X, $Z);
|
||||
}
|
||||
|
||||
public function checkTime(){
|
||||
if(!isset($this->level)){
|
||||
return false;
|
||||
|
@ -50,7 +50,7 @@ class WorldGenerator{
|
||||
|
||||
//Generate 4 chunks for spawning players
|
||||
for($Z = 7; $Z <= 8; ++$Z){
|
||||
for($X = 7; $X <= 8; ++$X){
|
||||
for($X = 7; $X <= 9; ++$X){
|
||||
$this->level->level->loadChunk($X, $Z);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user