summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_9.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-08-29 18:29:30 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-08-29 18:29:30 +0200
commitbb11091402142daf2f9e8294a256bb7222bbc344 (patch)
treeb8a4828b72991b39a5cbf3ed4bc07357f9399972 /src/Protocol/Protocol_1_9.cpp
parentFixed some headers, incorprated some code from the conflicts (diff)
parentcUUID: Fix FromHexDigit for digits >= 'a' (diff)
downloadcuberite-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.cpp49
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());