From 3406957f1b4b6b49c1b571dcceb2b463def9e4c3 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 17 Sep 2014 09:38:06 +0200 Subject: Initial BungeeCord support. Ref.: #1392 --- src/Protocol/Protocol17x.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Protocol/Protocol17x.cpp') diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index f07f6a928..9ebb6b4b0 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -100,6 +100,15 @@ cProtocol172::cProtocol172(cClientHandle * a_Client, const AString & a_ServerAdd m_IsEncrypted(false), m_LastSentDimension(dimNotSet) { + // 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 (SplitZeroTerminatedStrings(a_ServerAddress, Params) && (Params.size() == 4)) + { + m_ServerAddress = Params[0]; + } + // Create the comm log file, if so requested: if (g_ShouldLogCommIn || g_ShouldLogCommOut) { -- cgit v1.2.3 From 82317709f8645642069c1ddf3428a0341302fcd4 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 17 Sep 2014 11:07:42 +0200 Subject: Full BungeeCord compatibility. Fixes #1392. Fixes SpigotMC/BungeeCord#1211. --- src/Protocol/Protocol17x.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Protocol/Protocol17x.cpp') diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 9ebb6b4b0..4f71b53b0 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -106,7 +106,11 @@ cProtocol172::cProtocol172(cClientHandle * a_Client, const AString & a_ServerAdd AStringVector Params; if (SplitZeroTerminatedStrings(a_ServerAddress, Params) && (Params.size() == 4)) { + LOGD("Player at %s connected via BungeeCord", Params[1].c_str()); m_ServerAddress = Params[0]; + m_Client->SetIPString(Params[1]); + m_Client->SetUUID(cMojangAPI::MakeUUIDShort(Params[2])); + m_Client->SetProperties(Params[3]); } // Create the comm log file, if so requested: -- cgit v1.2.3 From 16e9deba8d61abad80ef8a1935db1207fd6c3a68 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 17 Sep 2014 20:55:46 +0200 Subject: Added an explicit setting for allowing BungeeCord handshake. --- src/Protocol/Protocol17x.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Protocol/Protocol17x.cpp') diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 4f71b53b0..7d80e79fb 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -104,7 +104,7 @@ cProtocol172::cProtocol172(cClientHandle * a_Client, const AString & a_ServerAdd // 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 (SplitZeroTerminatedStrings(a_ServerAddress, Params) && (Params.size() == 4)) + if (cRoot::Get()->GetServer()->ShouldAllowBungeeCord() && SplitZeroTerminatedStrings(a_ServerAddress, Params) && (Params.size() == 4)) { LOGD("Player at %s connected via BungeeCord", Params[1].c_str()); m_ServerAddress = Params[0]; -- cgit v1.2.3