diff options
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r-- | src/ClientHandle.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index caa2d8fd8..dbd6d4b4e 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -64,6 +64,7 @@ float cClientHandle::FASTBREAK_PERCENTAGE; cClientHandle::cClientHandle(const AString & a_IPString, int a_ViewDistance) : m_LastSentDimension(dimNotSet), + m_ForgeHandshake(this), m_CurrentViewDistance(a_ViewDistance), m_RequestedViewDistance(a_ViewDistance), m_IPString(a_IPString), @@ -320,7 +321,6 @@ void cClientHandle::Authenticate(const AString & a_Name, const cUUID & a_UUID, c // Atomically increment player count (in server thread) cRoot::Get()->GetServer()->PlayerCreated(); - cWorld * World; { cCSLock lock(m_CSState); /* @@ -351,6 +351,25 @@ void cClientHandle::Authenticate(const AString & a_Name, const cUUID & a_UUID, c // Send login success (if the protocol supports it): m_Protocol->SendLoginSuccess(); + if (m_ForgeHandshake.m_IsForgeClient) + { + m_ForgeHandshake.BeginForgeHandshake(a_Name, a_UUID, a_Properties); + } + else + { + FinishAuthenticate(a_Name, a_UUID, a_Properties); + } + } +} + + + + + +void cClientHandle::FinishAuthenticate(const AString & a_Name, const cUUID & a_UUID, const Json::Value & a_Properties) +{ + cWorld * World; + { // Spawn player (only serversided, so data is loaded) m_PlayerPtr = cpp14::make_unique<cPlayer>(m_Self, GetUsername()); m_Player = m_PlayerPtr.get(); @@ -854,6 +873,10 @@ void cClientHandle::HandlePluginMessage(const AString & a_Channel, const AString { UnregisterPluginChannels(BreakApartPluginChannels(a_Message)); } + else if (a_Channel == "FML|HS") + { + m_ForgeHandshake.DataReceived(this, a_Message.c_str(), a_Message.size()); + } else if (!HasPluginChannel(a_Channel)) { // Ignore if client sent something but didn't register the channel first |