From 1d651046c98cfe89ec68a9c50ee2a25eae4a0256 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 25 Oct 2017 17:12:17 +0100 Subject: [PATCH] Compute time in milliseconds once and use it for both firstPlayed and lastPlayed fixes issues where lastPlayed can be a tiny fraction of time into the future of firstPlayed when players join for the first time --- src/pocketmine/Server.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index de6e973ea..f7a206c8a 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -757,9 +757,11 @@ class Server{ } } $spawn = $this->getDefaultLevel()->getSafeSpawn(); + $currentTimeMillis = (int) (microtime(true) * 1000); + $nbt = new CompoundTag("", [ - new LongTag("firstPlayed", (int) (microtime(true) * 1000)), - new LongTag("lastPlayed", (int) (microtime(true) * 1000)), + new LongTag("firstPlayed", $currentTimeMillis), + new LongTag("lastPlayed", $currentTimeMillis), new ListTag("Pos", [ new DoubleTag("", $spawn->x), new DoubleTag("", $spawn->y),