summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-08-01 22:35:12 +0200
committerMattes D <github@xoft.cz>2014-08-01 22:35:12 +0200
commit941a182d8a8a210bb6400cc6b2750a06b5f6c038 (patch)
tree82dfee0f38536020345a820c84ff2c4f01c3213b /src/Entities
parentMerge pull request #1273 from Howaner/GlobalFixes (diff)
parentMerged branch 'master' into NameToUUID. (diff)
downloadcuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar
cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar.gz
cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar.bz2
cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar.lz
cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar.xz
cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.tar.zst
cuberite-941a182d8a8a210bb6400cc6b2750a06b5f6c038.zip
Diffstat (limited to 'src/Entities')
-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 c9d885b89..ca3b1f367 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1705,8 +1705,10 @@ bool cPlayer::LoadFromDisk(cWorldPtr & a_World)
// 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), a_World))
{
return true;
@@ -1729,8 +1731,8 @@ bool cPlayer::LoadFromDisk(cWorldPtr & a_World)
}
// 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
);
if (a_World == NULL)
@@ -2237,12 +2239,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 f188789b8..917e87a89 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -551,7 +551,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;