From 363c2119b5a61549b0556bacfe9183d05d55ed72 Mon Sep 17 00:00:00 2001 From: Muqsit Date: Thu, 13 Jul 2023 22:39:37 +0000 Subject: [PATCH] Fix #216 --- .../session/network/handler/PlayerNetworkHandlerRegistry.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/muqsit/invmenu/session/network/handler/PlayerNetworkHandlerRegistry.php b/src/muqsit/invmenu/session/network/handler/PlayerNetworkHandlerRegistry.php index 133e861..836dc24 100644 --- a/src/muqsit/invmenu/session/network/handler/PlayerNetworkHandlerRegistry.php +++ b/src/muqsit/invmenu/session/network/handler/PlayerNetworkHandlerRegistry.php @@ -7,6 +7,7 @@ use Closure; use muqsit\invmenu\session\network\NetworkStackLatencyEntry; use pocketmine\network\mcpe\protocol\types\DeviceOS; +use function mt_rand; final class PlayerNetworkHandlerRegistry{ @@ -17,7 +18,8 @@ final class PlayerNetworkHandlerRegistry{ public function __construct(){ $this->registerDefault(new ClosurePlayerNetworkHandler(static function(Closure $then) : NetworkStackLatencyEntry{ - return new NetworkStackLatencyEntry(mt_rand() * 1000 /* TODO: remove this hack */, $then); + $timestamp = mt_rand(); + return new NetworkStackLatencyEntry($timestamp * 1000000, $then, $timestamp); })); $this->register(DeviceOS::PLAYSTATION, new ClosurePlayerNetworkHandler(static function(Closure $then) : NetworkStackLatencyEntry{ $timestamp = mt_rand();