fallback to hex string when a player UUID has no corresponding filename
This commit is contained in:
parent
81198f091c
commit
de53f8c7d7
@ -272,11 +272,13 @@ Json PlayerStorage::getMetadata(String const& key) {
|
||||
return m_metadata.value(key);
|
||||
}
|
||||
|
||||
String const& PlayerStorage::uuidFileName(Uuid const& uuid) const {
|
||||
String const& PlayerStorage::uuidFileName(Uuid const& uuid) {
|
||||
if (auto fileName = m_playerFileNames.rightPtr(uuid))
|
||||
return *fileName;
|
||||
else
|
||||
throw PlayerException::format("No matching filename for uuid '{}'", uuid.hex());
|
||||
else {
|
||||
m_playerFileNames.insert(uuid, uuid.hex());
|
||||
return *m_playerFileNames.rightPtr(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerStorage::writeMetadata() {
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
Json getMetadata(String const& key);
|
||||
|
||||
private:
|
||||
String const& uuidFileName(Uuid const& uuid) const;
|
||||
String const& uuidFileName(Uuid const& uuid);
|
||||
void writeMetadata();
|
||||
|
||||
mutable RecursiveMutex m_mutex;
|
||||
|
Loading…
Reference in New Issue
Block a user