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() . " kB/s | TPS " . $this->getTicksPerSecondAverage() .
" | Load " . $this->getTickUsageAverage() . "%\x07"; " | Load " . $this->getTickUsageAverage() . "%\x07";
$this->network->resetStatistics();
Timings::$titleTickTimer->stopTiming(); Timings::$titleTickTimer->stopTiming();
} }
@ -2518,13 +2516,17 @@ class Server{
$player->checkNetwork(); $player->checkNetwork();
} }
if(($this->tickCounter & 0b1111) === 0){ if(($this->tickCounter % 20) === 0){
if($this->doTitleTick and Terminal::hasFormattingCodes()){ if($this->doTitleTick and Terminal::hasFormattingCodes()){
$this->titleTick(); $this->titleTick();
} }
$this->currentTPS = 20; $this->currentTPS = 20;
$this->currentUse = 0; $this->currentUse = 0;
$this->network->updateName();
$this->network->resetStatistics();
}
if(($this->tickCounter & 0b111111111) === 0){ if(($this->tickCounter & 0b111111111) === 0){
try{ try{
$this->getPluginManager()->callEvent($this->queryRegenerateTask = new QueryRegenerateEvent($this, 5)); $this->getPluginManager()->callEvent($this->queryRegenerateTask = new QueryRegenerateEvent($this, 5));
@ -2536,9 +2538,6 @@ class Server{
} }
} }
$this->getNetwork()->updateName();
}
if($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks){ if($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks){
$this->autoSaveTicker = 0; $this->autoSaveTicker = 0;
$this->doAutoSave(); $this->doAutoSave();