1
0

Merge pull request #1255 from mc-server/NameToUUID

Name to UUID
This commit is contained in:
Mattes D
2014-08-01 22:35:12 +02:00
22 changed files with 860 additions and 158 deletions

View File

@@ -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;
}