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
This commit is contained in:
Dylan K. Taylor 2017-10-05 16:48:50 +01:00
parent b0104099fe
commit 18448cbcb8

View File

@ -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){