summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-11 23:12:57 +0200
committermadmaxoft <github@xoft.cz>2014-07-11 23:12:57 +0200
commitf73042fb02ead13aa870f061a08f56d84ed1dc99 (patch)
tree537a7413f3c19056238a01df5030f61d0c6d2eb3 /src/Entities/Player.cpp
parentPlayer data filenames are based on UUID. (diff)
downloadcuberite-f73042fb02ead13aa870f061a08f56d84ed1dc99.tar
cuberite-f73042fb02ead13aa870f061a08f56d84ed1dc99.tar.gz
cuberite-f73042fb02ead13aa870f061a08f56d84ed1dc99.tar.bz2
cuberite-f73042fb02ead13aa870f061a08f56d84ed1dc99.tar.lz
cuberite-f73042fb02ead13aa870f061a08f56d84ed1dc99.tar.xz
cuberite-f73042fb02ead13aa870f061a08f56d84ed1dc99.tar.zst
cuberite-f73042fb02ead13aa870f061a08f56d84ed1dc99.zip
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 4e1314209..944ed643e 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1692,8 +1692,7 @@ bool cPlayer::LoadFromDisk(void)
LoadPermissionsFromDisk();
// Load from the UUID file:
- bool res = LoadFromFile(GetUUIDFileName(m_UUID));
- if (res)
+ if (LoadFromFile(GetUUIDFileName(m_UUID)))
{
return true;
}
@@ -1702,8 +1701,7 @@ bool cPlayer::LoadFromDisk(void)
AString OfflineUUID = cClientHandle::GenerateOfflineUUID(GetName());
if (cRoot::Get()->GetServer()->ShouldLoadOfflinePlayerData())
{
- res = LoadFromFile(GetUUIDFileName(OfflineUUID));
- if (res)
+ if (LoadFromFile(GetUUIDFileName(OfflineUUID)))
{
return true;
}
@@ -1713,18 +1711,19 @@ bool cPlayer::LoadFromDisk(void)
if (cRoot::Get()->GetServer()->ShouldLoadNamedPlayerData())
{
AString OldStyleFileName = Printf("players/%s.json", GetName().c_str());
- res = LoadFromFile(OldStyleFileName);
- if (res)
+ if (LoadFromFile(OldStyleFileName))
{
// Save in new format and remove the old file
- SaveToDisk();
- cFile::Delete(OldStyleFileName);
+ if (SaveToDisk())
+ {
+ cFile::Delete(OldStyleFileName);
+ }
return true;
}
}
// None of the files loaded successfully
- LOGD("Player data file not found for %s (%s, offline %s), will be reset to defaults.",
+ 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()
);
return false;