summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 9ae0b4adc..80819cb61 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -373,16 +373,22 @@ void cClientHandle::FinishAuthenticate(const AString & a_Name, const cUUID & a_U
InvalidateCachedSentChunk();
m_Self.reset();
- World = cRoot::Get()->GetWorld(m_Player->GetLoadedWorldName());
- if (World == nullptr)
+
+ // New player use default world
+ // Player who can load from disk, use loaded world
+ if (m_Player->GetWorld() == nullptr)
{
- World = cRoot::Get()->GetDefaultWorld();
- m_Player->SetPosition(World->GetSpawnX(), World->GetSpawnY(), World->GetSpawnZ());
+ World = cRoot::Get()->GetWorld(m_Player->GetLoadedWorldName());
+ if (World == nullptr)
+ {
+ World = cRoot::Get()->GetDefaultWorld();
+ m_Player->SetPosition(World->GetSpawnX(), World->GetSpawnY(), World->GetSpawnZ());
+ }
+ m_Player->SetWorld(World);
}
-
- if (m_Player->GetGameMode() == eGameMode_NotSet)
+ else
{
- m_Player->LoginSetGameMode(World->GetGameMode());
+ World = m_Player->GetWorld();
}
m_Player->SetIP (m_IPString);
@@ -425,7 +431,6 @@ void cClientHandle::FinishAuthenticate(const AString & a_Name, const cUUID & a_U
cRoot::Get()->BroadcastPlayerListsAddPlayer(*m_Player);
cRoot::Get()->SendPlayerLists(m_Player);
- m_Player->SetWorld(World);
m_State = csAuthenticated;
}