| 195 | } |
| 196 | |
| 197 | PlayerPtr PlayerStorage::loadPlayer(Uuid const& uuid) { |
| 198 | auto playerCacheData = getPlayerData(uuid); |
| 199 | auto entityFactory = Root::singleton().entityFactory(); |
| 200 | try { |
| 201 | auto player = convert<Player>(entityFactory->diskLoadEntity(EntityType::Player, playerCacheData)); |
| 202 | if (player->uuid() != uuid) |
| 203 | throw PlayerException(strf("Uuid mismatch in loaded player with filename uuid '{}'", uuid.hex())); |
| 204 | return player; |
| 205 | } catch (std::exception const& e) { |
| 206 | Logger::error("Error loading player file, ignoring! {}", outputException(e, false)); |
| 207 | RecursiveMutexLocker locker(m_mutex); |
| 208 | m_savedPlayersCache.remove(uuid); |
| 209 | return {}; |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | void PlayerStorage::deletePlayer(Uuid const& uuid) { |
| 214 | RecursiveMutexLocker locker(m_mutex); |
no test coverage detected