summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-10-05 20:19:21 +0200
committerMattes D <github@xoft.cz>2014-10-05 20:19:21 +0200
commita8aeceab9d6e5e5e36ef7bd58783b65aca4d8be7 (patch)
treeae3a23a0691b741c7b369f84a1de96126bf73aa6 /src/ClientHandle.cpp
parentUpdate README.md (diff)
downloadcuberite-a8aeceab9d6e5e5e36ef7bd58783b65aca4d8be7.tar
cuberite-a8aeceab9d6e5e5e36ef7bd58783b65aca4d8be7.tar.gz
cuberite-a8aeceab9d6e5e5e36ef7bd58783b65aca4d8be7.tar.bz2
cuberite-a8aeceab9d6e5e5e36ef7bd58783b65aca4d8be7.tar.lz
cuberite-a8aeceab9d6e5e5e36ef7bd58783b65aca4d8be7.tar.xz
cuberite-a8aeceab9d6e5e5e36ef7bd58783b65aca4d8be7.tar.zst
cuberite-a8aeceab9d6e5e5e36ef7bd58783b65aca4d8be7.zip
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r--src/ClientHandle.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index a29bef0c0..3b677460b 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -92,7 +92,8 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance) :
m_NumBlockChangeInteractionsThisTick(0),
m_UniqueID(0),
m_HasSentPlayerChunk(false),
- m_Locale("en_GB")
+ m_Locale("en_GB"),
+ m_ProtocolVersion(0)
{
m_Protocol = new cProtocolRecognizer(this);
@@ -583,15 +584,22 @@ void cClientHandle::HandlePing(void)
bool cClientHandle::HandleLogin(int a_ProtocolVersion, const AString & a_Username)
{
+ // If the protocol version hasn't been set yet, set it now:
+ if (m_ProtocolVersion == 0)
+ {
+ m_ProtocolVersion = a_ProtocolVersion;
+ }
+
m_Username = a_Username;
+ // Let the plugins know about this event, they may refuse the player:
if (cRoot::Get()->GetPluginManager()->CallHookLogin(this, a_ProtocolVersion, a_Username))
{
Destroy();
return false;
}
- // Schedule for authentication; until then, let them wait (but do not block)
+ // Schedule for authentication; until then, let the player wait (but do not block)
m_State = csAuthenticating;
cRoot::Get()->GetAuthenticator().Authenticate(GetUniqueID(), GetUsername(), m_Protocol->GetAuthServerID());
return true;