From e8be8550a05864295a7808e0793e64ad99e0ec84 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 27 Jul 2017 10:57:37 +0100 Subject: [PATCH] Fixed possible issues with tick counters being inaccurate when the server lags --- src/pocketmine/Player.php | 4 ++-- src/pocketmine/entity/Entity.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 8b506bebf..09dbad881 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1651,7 +1651,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->sendAttributes(); if(!$this->isAlive() and $this->spawned){ - ++$this->deadTicks; + $this->deadTicks += $tickDiff; if($this->deadTicks >= 10){ $this->despawnFromAll(); } @@ -1689,7 +1689,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ } } - ++$this->inAirTicks; + $this->inAirTicks += $tickDiff; } } } diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index a4f44193b..f1ed6bc87 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1252,7 +1252,7 @@ abstract class Entity extends Location implements Metadatable{ } if(!$this->isAlive()){ - ++$this->deadTicks; + $this->deadTicks += $tickDiff; if($this->deadTicks >= 10){ $this->despawnFromAll(); if(!$this->isPlayer){