mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
Added "view-distance" setting to change chunk sending radius
This commit is contained in:
parent
e88c337229
commit
dccfbfd572
@ -96,6 +96,7 @@ class ServerAPI{
|
||||
"white-list" => false,
|
||||
"debug" => 1,
|
||||
"spawn-protection" => 16,
|
||||
"view-distance" => 7,
|
||||
"max-players" => 20,
|
||||
"server-type" => "normal",
|
||||
"time-per-second" => 20,
|
||||
|
@ -107,10 +107,10 @@ class Player{
|
||||
asort($this->chunksOrder);
|
||||
}
|
||||
|
||||
public function getNextChunk(){
|
||||
public function getNextChunk($repeat = false){
|
||||
$c = key($this->chunksOrder);
|
||||
$d = $this->chunksOrder[$c];
|
||||
if($c === null or $d > 6){
|
||||
if($c === null or $d > $this->server->getProperty("view-distance")){
|
||||
$this->server->schedule(50, array($this, "getNextChunk"));
|
||||
return false;
|
||||
}
|
||||
@ -139,7 +139,11 @@ class Player{
|
||||
$this->server->api->tileentity->spawnTo($tile["ID"], $this);
|
||||
}
|
||||
}
|
||||
$this->server->schedule(0.5, array($this, "getNextChunk"));
|
||||
if($repeat === false){
|
||||
$this->getNextChunk(true);
|
||||
}
|
||||
|
||||
$this->server->schedule(1, array($this, "getNextChunk"));
|
||||
}
|
||||
|
||||
public function onTick($time, $event){
|
||||
|
Loading…
x
Reference in New Issue
Block a user