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);
|
$c = key($this->chunksOrder);
|
||||||
$d = @$this->chunksOrder[$c];
|
$d = @$this->chunksOrder[$c];
|
||||||
if($c === null){
|
if($c === null or $d === null){
|
||||||
$this->server->schedule(50, array($this, "getNextChunk"));
|
$this->server->schedule(40, array($this, "getNextChunk"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
unset($this->chunksOrder[$c]);
|
unset($this->chunksOrder[$c]);
|
||||||
|
@ -212,26 +212,25 @@ class PMFLevel extends PMF{
|
|||||||
$this->isGenerated($X - 1, $Z - 1) and
|
$this->isGenerated($X - 1, $Z - 1) and
|
||||||
$this->isGenerated($X + 1, $Z - 1) and
|
$this->isGenerated($X + 1, $Z - 1) and
|
||||||
$this->isGenerated($X - 1, $Z + 1)){
|
$this->isGenerated($X - 1, $Z + 1)){
|
||||||
$this->level->populateChunk($X, $Z);
|
$this->level->populateChunk($X, $Z);
|
||||||
$this->saveChunk($X, $Z);
|
$this->saveChunk($X, $Z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadChunk($X, $Z){
|
public function loadChunk($X, $Z){
|
||||||
$X = (int) $X;
|
|
||||||
$Z = (int) $Z;
|
|
||||||
$index = self::getIndex($X, $Z);
|
|
||||||
if($this->isChunkLoaded($X, $Z)){
|
if($this->isChunkLoaded($X, $Z)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
$index = self::getIndex($X, $Z);
|
||||||
$path = $this->getChunkPath($X, $Z);
|
$path = $this->getChunkPath($X, $Z);
|
||||||
if(!file_exists($path)){
|
if(!file_exists($path)){
|
||||||
if($this->generateChunk($X, $Z) === false){
|
if($this->generateChunk($X, $Z) === false){
|
||||||
return 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");
|
$chunk = @gzopen($path, "rb");
|
||||||
|
@ -77,6 +77,10 @@ class Level{
|
|||||||
unset($this->usedChunks[$X.".".$Z][$player->CID]);
|
unset($this->usedChunks[$X.".".$Z][$player->CID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isChunkPopulated($X, $Z){
|
||||||
|
return $this->level->isPopulated($X, $Z);
|
||||||
|
}
|
||||||
|
|
||||||
public function checkTime(){
|
public function checkTime(){
|
||||||
if(!isset($this->level)){
|
if(!isset($this->level)){
|
||||||
return false;
|
return false;
|
||||||
|
@ -50,7 +50,7 @@ class WorldGenerator{
|
|||||||
|
|
||||||
//Generate 4 chunks for spawning players
|
//Generate 4 chunks for spawning players
|
||||||
for($Z = 7; $Z <= 8; ++$Z){
|
for($Z = 7; $Z <= 8; ++$Z){
|
||||||
for($X = 7; $X <= 8; ++$X){
|
for($X = 7; $X <= 9; ++$X){
|
||||||
$this->level->level->loadChunk($X, $Z);
|
$this->level->level->loadChunk($X, $Z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user