diff options
Diffstat (limited to 'src/Entities/Player.cpp')
-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); |