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
This commit is contained in:
Dylan K. Taylor 2017-10-25 17:12:17 +01:00
parent 1dea25d123
commit 1d651046c9

View File

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