summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorchangyong guo <guo1487@163.com>2018-07-23 01:35:32 +0200
committerpeterbell10 <peterbell10@live.co.uk>2018-07-23 01:35:32 +0200
commit7b0db672d1ff72caec1f45cbc0c855680337766d (patch)
treedf2d4d43418ba307983e5be1d2ed4999c786f02a /src/ClientHandle.cpp
parentrecover hotbar selected slot after reconnect (#4249) (diff)
downloadcuberite-7b0db672d1ff72caec1f45cbc0c855680337766d.tar
cuberite-7b0db672d1ff72caec1f45cbc0c855680337766d.tar.gz
cuberite-7b0db672d1ff72caec1f45cbc0c855680337766d.tar.bz2
cuberite-7b0db672d1ff72caec1f45cbc0c855680337766d.tar.lz
cuberite-7b0db672d1ff72caec1f45cbc0c855680337766d.tar.xz
cuberite-7b0db672d1ff72caec1f45cbc0c855680337766d.tar.zst
cuberite-7b0db672d1ff72caec1f45cbc0c855680337766d.zip
Diffstat (limited to '')
-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;
}