diff options
author | peterbell10 <peterbell10@live.co.uk> | 2017-08-25 14:43:18 +0200 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2017-08-25 14:43:18 +0200 |
commit | f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7 (patch) | |
tree | 70139b1ad7ed221e4b75c3a9e247b337de68eb07 /src/Entities/Player.cpp | |
parent | compile.sh update. Fixed -d and -n, intelligent thread choice (#3960) (diff) | |
download | cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar.gz cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar.bz2 cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar.lz cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar.xz cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar.zst cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Player.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 60da8c758..fb2274cad 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -84,7 +84,7 @@ cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) : m_bIsInBed(false), m_TicksUntilNextSave(PLAYER_INVENTORY_SAVE_INTERVAL), m_bIsTeleporting(false), - m_UUID((a_Client != nullptr) ? a_Client->GetUUID() : ""), + m_UUID((a_Client != nullptr) ? a_Client->GetUUID() : cUUID{}), m_CustomName(""), m_SkinParts(0), m_MainHand(mhRight) @@ -2077,7 +2077,7 @@ bool cPlayer::LoadFromDisk(cWorldPtr & a_World) } // Load from the offline UUID file, if allowed: - AString OfflineUUID = cClientHandle::GenerateOfflineUUID(GetName()); + cUUID OfflineUUID = cClientHandle::GenerateOfflineUUID(GetName()); const char * OfflineUsage = " (unused)"; if (cRoot::Get()->GetServer()->ShouldLoadOfflinePlayerData()) { @@ -2105,7 +2105,7 @@ bool cPlayer::LoadFromDisk(cWorldPtr & a_World) // None of the files loaded successfully LOG("Player data file not found for %s (%s, offline %s%s), will be reset to defaults.", - GetName().c_str(), m_UUID.c_str(), OfflineUUID.c_str(), OfflineUsage + GetName().c_str(), m_UUID.ToShortString().c_str(), OfflineUUID.ToShortString().c_str(), OfflineUsage ); if (a_World == nullptr) @@ -2220,7 +2220,7 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World) bool cPlayer::SaveToDisk() { cFile::CreateFolder(FILE_IO_PREFIX + AString("players/")); // Create the "players" folder, if it doesn't exist yet (#1268) - cFile::CreateFolder(FILE_IO_PREFIX + AString("players/") + m_UUID.substr(0, 2)); + cFile::CreateFolder(FILE_IO_PREFIX + AString("players/") + m_UUID.ToShortString().substr(0, 2)); // create the JSON data Json::Value JSON_PlayerPosition; @@ -2879,10 +2879,9 @@ void cPlayer::RemoveClientHandle(void) -AString cPlayer::GetUUIDFileName(const AString & a_UUID) +AString cPlayer::GetUUIDFileName(const cUUID & a_UUID) { - AString UUID = cMojangAPI::MakeUUIDDashed(a_UUID); - ASSERT(UUID.length() == 36); + AString UUID = a_UUID.ToLongString(); AString res("players/"); res.append(UUID, 0, 2); |