diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-08-29 18:29:30 +0200 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-08-29 18:29:30 +0200 |
commit | bb11091402142daf2f9e8294a256bb7222bbc344 (patch) | |
tree | b8a4828b72991b39a5cbf3ed4bc07357f9399972 /src/Protocol/Protocol_1_9.cpp | |
parent | Fixed some headers, incorprated some code from the conflicts (diff) | |
parent | cUUID: Fix FromHexDigit for digits >= 'a' (diff) | |
download | cuberite-bb11091402142daf2f9e8294a256bb7222bbc344.tar cuberite-bb11091402142daf2f9e8294a256bb7222bbc344.tar.gz cuberite-bb11091402142daf2f9e8294a256bb7222bbc344.tar.bz2 cuberite-bb11091402142daf2f9e8294a256bb7222bbc344.tar.lz cuberite-bb11091402142daf2f9e8294a256bb7222bbc344.tar.xz cuberite-bb11091402142daf2f9e8294a256bb7222bbc344.tar.zst cuberite-bb11091402142daf2f9e8294a256bb7222bbc344.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol_1_9.cpp | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index b9310bea5..7eeba06b4 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -124,21 +124,46 @@ cProtocol_1_9_0::cProtocol_1_9_0(cClientHandle * a_Client, const AString & a_Ser m_IsEncrypted(false) { - // BungeeCord handling: - // If BC is setup with ip_forward == true, it sends additional data in the login packet's ServerAddress field: - // hostname\00ip-address\00uuid\00profile-properties-as-json AStringVector Params; - if (cRoot::Get()->GetServer()->ShouldAllowBungeeCord() && SplitZeroTerminatedStrings(a_ServerAddress, Params) && (Params.size() == 4)) + SplitZeroTerminatedStrings(a_ServerAddress, Params); + + if (Params.size() >= 2) { - LOGD("Player at %s connected via BungeeCord", Params[1].c_str()); m_ServerAddress = Params[0]; - m_Client->SetIPString(Params[1]); - cUUID UUID; - UUID.FromString(Params[2]); - m_Client->SetUUID(UUID); + if (Params[1] == "FML") + { + LOGD("Forge client connected!"); + m_Client->SetIsForgeClient(); + } + else if (Params.size() == 4) + { + if (cRoot::Get()->GetServer()->ShouldAllowBungeeCord()) + { + // BungeeCord handling: + // If BC is setup with ip_forward == true, it sends additional data in the login packet's ServerAddress field: + // hostname\00ip-address\00uuid\00profile-properties-as-json + + LOGD("Player at %s connected via BungeeCord", Params[1].c_str()); + + m_Client->SetIPString(Params[1]); + + cUUID UUID; + UUID.FromString(Params[2]); + m_Client->SetUUID(UUID); - m_Client->SetProperties(Params[3]); + m_Client->SetProperties(Params[3]); + } + else + { + LOG("BungeeCord is disabled, but client sent additional data, set AllowBungeeCord=1 if you want to allow it"); + } + } + else + { + LOG("Unknown additional data sent in server address (BungeeCord/FML?): " SIZE_T_FMT " parameters", Params.size()); + // TODO: support FML + BungeeCord? (what parameters does it send in that case?) https://github.com/SpigotMC/BungeeCord/issues/899 + } } // Create the comm log file, if so requested: @@ -2194,6 +2219,7 @@ void cProtocol_1_9_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) ResponseValue["version"] = Version; ResponseValue["players"] = Players; ResponseValue["description"] = Description; + m_Client->ForgeAugmentServerListPing(ResponseValue); if (!Favicon.empty()) { ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); @@ -4205,6 +4231,7 @@ void cProtocol_1_9_1::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) ResponseValue["version"] = Version; ResponseValue["players"] = Players; ResponseValue["description"] = Description; + m_Client->ForgeAugmentServerListPing(ResponseValue); if (!Favicon.empty()) { ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); @@ -4262,6 +4289,7 @@ void cProtocol_1_9_2::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) ResponseValue["version"] = Version; ResponseValue["players"] = Players; ResponseValue["description"] = Description; + m_Client->ForgeAugmentServerListPing(ResponseValue); if (!Favicon.empty()) { ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); @@ -4319,6 +4347,7 @@ void cProtocol_1_9_4::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) ResponseValue["version"] = Version; ResponseValue["players"] = Players; ResponseValue["description"] = Description; + m_Client->ForgeAugmentServerListPing(ResponseValue); if (!Favicon.empty()) { ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str()); |