summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-31 22:52:06 +0200
committermadmaxoft <github@xoft.cz>2014-07-31 22:52:06 +0200
commitecb86935f87ce2b9f1ae4671d8a8b722c798b8a2 (patch)
treecc214a3677d4ee717153de02956959b2178b8d9f
parentMojangAPI: Moved the settings to a separate ini section. (diff)
downloadcuberite-ecb86935f87ce2b9f1ae4671d8a8b722c798b8a2.tar
cuberite-ecb86935f87ce2b9f1ae4671d8a8b722c798b8a2.tar.gz
cuberite-ecb86935f87ce2b9f1ae4671d8a8b722c798b8a2.tar.bz2
cuberite-ecb86935f87ce2b9f1ae4671d8a8b722c798b8a2.tar.lz
cuberite-ecb86935f87ce2b9f1ae4671d8a8b722c798b8a2.tar.xz
cuberite-ecb86935f87ce2b9f1ae4671d8a8b722c798b8a2.tar.zst
cuberite-ecb86935f87ce2b9f1ae4671d8a8b722c798b8a2.zip
-rw-r--r--src/Entities/Player.cpp13
-rw-r--r--src/Entities/Player.h2
2 files changed, 9 insertions, 6 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index fcc8eb9a0..477334948 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1700,8 +1700,10 @@ bool cPlayer::LoadFromDisk(void)
// Load from the offline UUID file, if allowed:
AString OfflineUUID = cClientHandle::GenerateOfflineUUID(GetName());
+ const char * OfflineUsage = " (unused)";
if (cRoot::Get()->GetServer()->ShouldLoadOfflinePlayerData())
{
+ OfflineUsage = "";
if (LoadFromFile(GetUUIDFileName(OfflineUUID)))
{
return true;
@@ -1724,8 +1726,8 @@ bool cPlayer::LoadFromDisk(void)
}
// None of the files loaded successfully
- LOG("Player data file not found for %s (%s, offline %s), will be reset to defaults.",
- GetName().c_str(), m_UUID.c_str(), OfflineUUID.c_str()
+ 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
);
return false;
}
@@ -2212,12 +2214,13 @@ void cPlayer::Detach()
AString cPlayer::GetUUIDFileName(const AString & a_UUID)
{
- ASSERT(a_UUID.size() == 36);
+ AString UUID = cMojangAPI::MakeUUIDDashed(a_UUID);
+ ASSERT(UUID.length() == 36);
AString res("players/");
- res.append(a_UUID, 0, 2);
+ res.append(UUID, 0, 2);
res.push_back('/');
- res.append(a_UUID, 2, AString::npos);
+ res.append(UUID, 2, AString::npos);
res.append(".json");
return res;
}
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index 488884602..29bb4c39d 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -536,7 +536,7 @@ protected:
*/
bool m_bIsTeleporting;
- /** The UUID of the player, as read from the ClientHandle.
+ /** The short UUID (no dashes) of the player, as read from the ClientHandle.
If no ClientHandle is given, the UUID is initialized to empty. */
AString m_UUID;