From 8a30a4a7b8a7ebbdbccb6995fd2f5c0f8011bace Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 28 Mar 2021 22:34:54 +0100 Subject: Player data loading cleanup * Kick player if data were corrupt to avoid making it worse --- src/Entities/Player.h | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'src/Entities/Player.h') diff --git a/src/Entities/Player.h b/src/Entities/Player.h index 2d31ef84b..4d6a41a35 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -379,21 +379,18 @@ public: void SetVisible( bool a_bVisible); // tolua_export bool IsVisible(void) const { return m_bVisible; } // tolua_export - /** Saves all player data, such as inventory, to JSON */ - bool SaveToDisk(void); + /** Saves all player data, such as inventory, to JSON. */ + void SaveToDisk(void); typedef cWorld * cWorldPtr; - /** Loads the player data from the disk file - Sets a_World to the world where the player will spawn, based on the stored world name or the default world by calling LoadFromFile() - Returns true on success, false on failure - */ - bool LoadFromDisk(cWorldPtr & a_World); + /** Loads the player data from the disk file. + Sets a_World to the world where the player will spawn, based on the stored world name or the default world by calling LoadFromFile(). */ + void LoadFromDisk(cWorldPtr & a_World); - /** Loads the player data from the specified file - Sets a_World to the world where the player will spawn, based on the stored world name or the default world - Returns true on success, false on failure - */ + /** Loads the player data from the specified file. + Sets a_World to the world where the player will spawn, based on the stored world name or the default world. + Returns true on success, false if the player wasn't found, and excepts with base std::runtime_error if the data couldn't be read or parsed. */ bool LoadFromFile(const AString & a_FileName, cWorldPtr & a_World); const AString & GetLoadedWorldName() const { return m_CurrentWorldName; } @@ -499,7 +496,7 @@ public: bool DoesPlacingBlocksIntersectEntity(const sSetBlockVector & a_Blocks); /** Returns the UUID that has been read from the client, or nil if not available. */ - const cUUID & GetUUID(void) const { return m_UUID; } // Exported in ManualBindings.cpp + const cUUID & GetUUID(void) const; // Exported in ManualBindings.cpp // tolua_begin @@ -507,7 +504,6 @@ public: virtual bool CanFly(void) const { return m_CanFly; } /** (Re)loads the rank and permissions from the cRankManager. - Expects the m_UUID member to be valid. Loads the m_Rank, m_Permissions, m_MsgPrefix, m_MsgSuffix and m_MsgNameColorCode members. */ void LoadRank(void); @@ -718,10 +714,6 @@ private: */ bool m_bIsTeleporting; - /** The UUID of the player, as read from the ClientHandle. - If no ClientHandle is given, the UUID is nil. */ - cUUID m_UUID; - AString m_CustomName; /** Displayed skin part bit mask */ -- cgit v1.2.3