summaryrefslogtreecommitdiffstats
path: root/src/Protocol/ProtocolRecognizer.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-12-16 00:28:12 +0100
committerGitHub <noreply@github.com>2016-12-16 00:28:12 +0100
commit71e14ee358e59314498e9b46484eff7e34ae6442 (patch)
tree56ca5369d83504ac063dbc3139f72dc2cdf42610 /src/Protocol/ProtocolRecognizer.cpp
parentAPIDump: Load the official undocumented from alternate location. (diff)
parentCompositeChat: Use shorter JSON format. (diff)
downloadcuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar
cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar.gz
cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar.bz2
cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar.lz
cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar.xz
cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.tar.zst
cuberite-71e14ee358e59314498e9b46484eff7e34ae6442.zip
Diffstat (limited to 'src/Protocol/ProtocolRecognizer.cpp')
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index 0c67f66f5..04ac1bb2b 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -7,9 +7,10 @@
#include "Globals.h"
#include "ProtocolRecognizer.h"
-#include "Protocol18x.h"
-#include "Protocol19x.h"
-#include "Protocol110x.h"
+#include "Protocol_1_8.h"
+#include "Protocol_1_9.h"
+#include "Protocol_1_10.h"
+#include "Protocol_1_11.h"
#include "Packetizer.h"
#include "../ClientHandle.h"
#include "../Root.h"
@@ -53,7 +54,8 @@ AString cProtocolRecognizer::GetVersionTextFromInt(int a_ProtocolVersion)
case PROTO_VERSION_1_9_1: return "1.9.1";
case PROTO_VERSION_1_9_2: return "1.9.2";
case PROTO_VERSION_1_9_4: return "1.9.4";
- case PROTO_VERSION_1_10_0: return "1.10";
+ case PROTO_VERSION_1_10_0: return "1.10";
+ case PROTO_VERSION_1_11_0: return "1.11";
}
ASSERT(!"Unknown protocol version");
return Printf("Unknown protocol (%d)", a_ProtocolVersion);
@@ -220,10 +222,10 @@ void cProtocolRecognizer::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSe
-void cProtocolRecognizer::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player)
+void cProtocolRecognizer::SendCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, int a_Count)
{
ASSERT(m_Protocol != nullptr);
- m_Protocol->SendCollectEntity(a_Entity, a_Player);
+ m_Protocol->SendCollectEntity(a_Entity, a_Player, a_Count);
}
@@ -978,8 +980,7 @@ void cProtocolRecognizer::SendData(const char * a_Data, size_t a_Size)
bool cProtocolRecognizer::TryRecognizeProtocol(void)
{
- // NOTE: If a new protocol is added or an old one is removed, adjust MCS_CLIENT_VERSIONS and
- // MCS_PROTOCOL_VERSIONS macros in the header file, as well as PROTO_VERSION_LATEST macro
+ // NOTE: If a new protocol is added or an old one is removed, adjust MCS_CLIENT_VERSIONS and MCS_PROTOCOL_VERSIONS macros in the header file
// Lengthed protocol, try if it has the entire initial handshake packet:
UInt32 PacketLen;
@@ -1045,37 +1046,42 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema
case PROTO_VERSION_1_8_0:
{
m_Buffer.CommitRead();
- m_Protocol = new cProtocol180(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol = new cProtocol_1_8_0(m_Client, ServerAddress, ServerPort, NextState);
return true;
}
case PROTO_VERSION_1_9_0:
{
- m_Protocol = new cProtocol190(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol = new cProtocol_1_9_0(m_Client, ServerAddress, ServerPort, NextState);
return true;
}
case PROTO_VERSION_1_9_1:
{
- m_Protocol = new cProtocol191(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol = new cProtocol_1_9_1(m_Client, ServerAddress, ServerPort, NextState);
return true;
}
case PROTO_VERSION_1_9_2:
{
- m_Protocol = new cProtocol192(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol = new cProtocol_1_9_2(m_Client, ServerAddress, ServerPort, NextState);
return true;
}
case PROTO_VERSION_1_9_4:
{
- m_Protocol = new cProtocol194(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol = new cProtocol_1_9_4(m_Client, ServerAddress, ServerPort, NextState);
return true;
}
case PROTO_VERSION_1_10_0:
{
- m_Protocol = new cProtocol1100(m_Client, ServerAddress, ServerPort, NextState);
+ m_Protocol = new cProtocol_1_10_0(m_Client, ServerAddress, ServerPort, NextState);
+ return true;
+ }
+ case PROTO_VERSION_1_11_0:
+ {
+ m_Protocol = new cProtocol_1_11_0(m_Client, ServerAddress, ServerPort, NextState);
return true;
}
default:
{
- LOGINFO("Client \"%s\" uses an unsupported protocol (lengthed, version %u (0x%x))",
+ LOGD("Client \"%s\" uses an unsupported protocol (lengthed, version %u (0x%x))",
m_Client->GetIPString().c_str(), ProtocolVersion, ProtocolVersion
);
if (NextState != 1)