diff --git a/src/API/ServerAPI.php b/src/API/ServerAPI.php index 805eddaf..739cdfc3 100644 --- a/src/API/ServerAPI.php +++ b/src/API/ServerAPI.php @@ -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")); diff --git a/src/Player.php b/src/Player.php index 80a07411..8234ac6f 100755 --- a/src/Player.php +++ b/src/Player.php @@ -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; } diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index 03c36eb9..1ce1fed6 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -1,7 +1,7 @@ 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(); }