added chunk send delay into server.properties(min=0, default=5)

This commit is contained in:
GameHerobrine 2023-11-28 03:32:34 +03:00
parent c150a46383
commit 07632377ac
4 changed files with 10 additions and 5 deletions

View file

@ -138,6 +138,7 @@ class ServerAPI{
"enable-rcon" => false,
"rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10),
"auto-save" => true,
"chunk-send-delay-ticks" => 5,
]);
Biome::init();
$this->parseProperties();
@ -151,6 +152,7 @@ class ServerAPI{
}
MobSpawner::$spawnAnimals = $this->getProperty("spawn-animals");
MobSpawner::$spawnMobs = $this->getProperty("spawn-mobs");
PocketMinecraftServer::$chukSendDelay = $this->getProperty("chunk-send-delay-ticks");
if($this->getProperty("upnp-forwarding") == true){
console("[INFO] [UPnP] Trying to port forward...");
UPnP_PortForward($this->getProperty("server-port"));

View file

@ -491,7 +491,7 @@ class Player{
}
if($this->isSleeping) ++$this->sleepingTime;
if($this->chunkTicker++ > 5){
if($this->chunkTicker++ > PocketMinecraftServer::$chukSendDelay){
$this->getNextChunk($this->level);
$this->chunkTicker = 0;
}

View file

@ -1,7 +1,7 @@
<?php
class PocketMinecraftServer{
public static $chukSendDelay = 5;
public $tCnt, $ticks;
public $extraprops, $serverID, $interface, $database, $version, $invisible, $tickMeasure, $preparedSQL, $seed, $gamemode, $name, $maxClients, $clients, $eidCnt, $custom, $description, $motd, $port, $saveEnabled;
/**

View file

@ -22,14 +22,17 @@ abstract class Living extends Entity implements Damageable, Pathfindable{
return $this->path != null;
}
public function __destruct()
{
parent::__destruct();
public function close(){
parent::close();
unset($this->pathFollower->entity);
unset($this->ai->entity);
unset($this->ai->mobController->entity);
unset($this->ai);
unset($this->parent);
}
public function update(){
if($this->closed) return;
if(!$this->dead && Entity::$allowedAI && $this->idleTime <= 0) {
$this->ai->updateTasks();
}