From 51091fe87b6c7610a5afdb86b756a6ad114b58e5 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 3 Jun 2017 22:55:57 +0100 Subject: [PATCH] Fix player data saving --- src/pocketmine/Player.php | 4 ++-- src/pocketmine/entity/Human.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 23fa85d89..9ff8d0dd6 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1825,7 +1825,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade $this->achievements[$achievement->getName()] = $achievement->getValue() > 0 ? true : false; } - $this->namedtag->lastPlayed = new LongTag("lastPlayed", floor(microtime(true) * 1000)); + $this->namedtag->lastPlayed = new LongTag("lastPlayed", (int) floor(microtime(true) * 1000)); if($this->server->getAutoSave()){ $this->server->saveOfflinePlayerData($this->username, $this->namedtag, true); } @@ -3747,7 +3747,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade } $this->namedtag["playerGameType"] = $this->gamemode; - $this->namedtag["lastPlayed"] = floor(microtime(true) * 1000); + $this->namedtag["lastPlayed"] = (int) floor(microtime(true) * 1000); if($this->username != "" and $this->namedtag instanceof CompoundTag){ $this->server->saveOfflinePlayerData($this->username, $this->namedtag, $async); diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index 8ef420317..092318166 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -317,7 +317,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ parent::initEntity(); if(!isset($this->namedtag->foodLevel) or !($this->namedtag->foodLevel instanceof IntTag)){ - $this->namedtag->foodLevel = new IntTag("foodLevel", $this->getFood()); + $this->namedtag->foodLevel = new IntTag("foodLevel", (int) $this->getFood()); }else{ $this->setFood($this->namedtag["foodLevel"]); } @@ -433,7 +433,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ public function saveNBT(){ parent::saveNBT(); - $this->namedtag->foodLevel = new IntTag("foodLevel", $this->getFood()); + $this->namedtag->foodLevel = new IntTag("foodLevel", (int) $this->getFood()); $this->namedtag->foodExhaustionLevel = new FloatTag("foodExhaustionLevel", $this->getExhaustion()); $this->namedtag->foodSaturationLevel = new FloatTag("foodSaturationLevel", $this->getSaturation()); $this->namedtag->foodTickTimer = new IntTag("foodTickTimer", $this->foodTickTimer);