From 18448cbcb8ceffaaee7790b54d1013780740684a Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 5 Oct 2017 16:48:50 +0100 Subject: [PATCH] Fixed several bugs with statistics updating and resetting - fixed ridiculous network stats when title ticker or console colours are disabled (shoghicp, what fit of madness led you to think this was a good idea) - fixed network stats reporting kb/16ticks instead of kb/s - fixed TPS reporting getting reset after 16 ticks instead of 20 - title ticker and MOTD is now updated every 20 ticks instead of 16 --- src/pocketmine/Server.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index a246644f4..1cf004dc6 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -2456,8 +2456,6 @@ class Server{ " kB/s | TPS " . $this->getTicksPerSecondAverage() . " | Load " . $this->getTickUsageAverage() . "%\x07"; - $this->network->resetStatistics(); - Timings::$titleTickTimer->stopTiming(); } @@ -2518,25 +2516,26 @@ class Server{ $player->checkNetwork(); } - if(($this->tickCounter & 0b1111) === 0){ + if(($this->tickCounter % 20) === 0){ if($this->doTitleTick and Terminal::hasFormattingCodes()){ $this->titleTick(); } $this->currentTPS = 20; $this->currentUse = 0; - if(($this->tickCounter & 0b111111111) === 0){ - try{ - $this->getPluginManager()->callEvent($this->queryRegenerateTask = new QueryRegenerateEvent($this, 5)); - if($this->queryHandler !== null){ - $this->queryHandler->regenerateInfo(); - } - }catch(\Throwable $e){ - $this->logger->logException($e); - } - } + $this->network->updateName(); + $this->network->resetStatistics(); + } - $this->getNetwork()->updateName(); + if(($this->tickCounter & 0b111111111) === 0){ + try{ + $this->getPluginManager()->callEvent($this->queryRegenerateTask = new QueryRegenerateEvent($this, 5)); + if($this->queryHandler !== null){ + $this->queryHandler->regenerateInfo(); + } + }catch(\Throwable $e){ + $this->logger->logException($e); + } } if($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks){