summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-08 14:59:15 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-08 14:59:15 +0200
commit791bf732fd490700748f798c617ecac1af152cd4 (patch)
tree2ca9be2cebeeb560b60c108959e805126d3173ed /source
parentPickups have an initial health of 5 (diff)
downloadcuberite-791bf732fd490700748f798c617ecac1af152cd4.tar
cuberite-791bf732fd490700748f798c617ecac1af152cd4.tar.gz
cuberite-791bf732fd490700748f798c617ecac1af152cd4.tar.bz2
cuberite-791bf732fd490700748f798c617ecac1af152cd4.tar.lz
cuberite-791bf732fd490700748f798c617ecac1af152cd4.tar.xz
cuberite-791bf732fd490700748f798c617ecac1af152cd4.tar.zst
cuberite-791bf732fd490700748f798c617ecac1af152cd4.zip
Diffstat (limited to 'source')
-rw-r--r--source/Protocol/Protocol125.cpp24
-rw-r--r--source/Protocol/Protocol125.h1
-rw-r--r--source/Protocol/Protocol16x.cpp32
-rw-r--r--source/Protocol/Protocol16x.h21
-rw-r--r--source/Protocol/ProtocolRecognizer.cpp7
-rw-r--r--source/Protocol/ProtocolRecognizer.h5
6 files changed, 88 insertions, 2 deletions
diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp
index f4976b9d8..97c193e97 100644
--- a/source/Protocol/Protocol125.cpp
+++ b/source/Protocol/Protocol125.cpp
@@ -86,6 +86,7 @@ enum
PACKET_UPDATE_SIGN = 0x82,
PACKET_PLAYER_LIST_ITEM = 0xC9,
PACKET_PLAYER_ABILITIES = 0xca,
+ PACKET_PLUGIN_MESSAGE = 0xfa,
PACKET_PING = 0xfe,
PACKET_DISCONNECT = 0xff
} ;
@@ -1039,6 +1040,7 @@ int cProtocol125::ParsePacket(unsigned char a_PacketType)
case PACKET_PLAYER_MOVE_LOOK: return ParsePlayerMoveLook();
case PACKET_PLAYER_ON_GROUND: return ParsePlayerOnGround();
case PACKET_PLAYER_POS: return ParsePlayerPosition();
+ case PACKET_PLUGIN_MESSAGE: return ParsePluginMessage();
case PACKET_RESPAWN: return ParseRespawn();
case PACKET_SLOT_SELECTED: return ParseSlotSelected();
case PACKET_UPDATE_SIGN: return ParseUpdateSign();
@@ -1330,6 +1332,28 @@ int cProtocol125::ParsePlayerPosition(void)
+int cProtocol125::ParsePluginMessage(void)
+{
+ HANDLE_PACKET_READ(ReadBEUTF16String16, AString, ChannelName);
+ HANDLE_PACKET_READ(ReadBEShort, short, Length);
+ AString Data;
+ if (!m_ReceivedData.ReadString(Data, Length))
+ {
+ m_ReceivedData.CheckValid();
+ return PARSE_INCOMPLETE;
+ }
+ m_ReceivedData.CheckValid();
+
+ // TODO: Process the data
+ LOGD("Received %d bytes of plugin data on channel \"%s\".", Length, ChannelName.c_str());
+
+ return PARSE_OK;
+}
+
+
+
+
+
int cProtocol125::ParseRespawn(void)
{
HANDLE_PACKET_READ(ReadBEInt, int, Dimension);
diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h
index 07eab3e7a..2f769f362 100644
--- a/source/Protocol/Protocol125.h
+++ b/source/Protocol/Protocol125.h
@@ -119,6 +119,7 @@ protected:
virtual int ParsePlayerMoveLook (void);
virtual int ParsePlayerOnGround (void);
virtual int ParsePlayerPosition (void);
+ virtual int ParsePluginMessage (void);
virtual int ParseRespawn (void);
virtual int ParseSlotSelected (void);
virtual int ParseUpdateSign (void);
diff --git a/source/Protocol/Protocol16x.cpp b/source/Protocol/Protocol16x.cpp
index a4572977d..7036dfbca 100644
--- a/source/Protocol/Protocol16x.cpp
+++ b/source/Protocol/Protocol16x.cpp
@@ -5,6 +5,8 @@
Implements the 1.6.x protocol classes:
- cProtocol161
- release 1.6.1 protocol (#73)
+ - cProtocol162
+ - release 1.6.2 protocol (#74)
(others may be added later in the future for the 1.6 release series)
*/
@@ -48,6 +50,8 @@ enum
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cProtocol161:
cProtocol161::cProtocol161(cClientHandle * a_Client) :
super(a_Client)
@@ -200,3 +204,31 @@ int cProtocol161::ParsePacket(unsigned char a_PacketType)
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cProtocol162:
+
+cProtocol162::cProtocol162(cClientHandle * a_Client) :
+ super(a_Client)
+{
+}
+
+
+
+
+
+void cProtocol162::SendPlayerMaxSpeed(void)
+{
+ cCSLock Lock(m_CSPacket);
+ WriteByte(PACKET_ENTITY_PROPERTIES);
+ WriteInt(m_Client->GetPlayer()->GetUniqueID());
+ WriteInt(1);
+ WriteString("generic.movementSpeed");
+ WriteDouble(m_Client->GetPlayer()->GetMaxSpeed());
+ WriteShort(0);
+ Flush();
+}
+
+
+
+
diff --git a/source/Protocol/Protocol16x.h b/source/Protocol/Protocol16x.h
index a357fc05f..4395108b9 100644
--- a/source/Protocol/Protocol16x.h
+++ b/source/Protocol/Protocol16x.h
@@ -5,6 +5,8 @@
Declares the 1.6.x protocol classes:
- cProtocol161
- release 1.6.1 protocol (#73)
+ - cProtocol162
+ - release 1.6.2 protocol (#74)
(others may be added later in the future for the 1.6 release series)
*/
@@ -28,6 +30,8 @@ class cProtocol161 :
public:
cProtocol161(cClientHandle * a_Client);
+protected:
+
// cProtocol150 overrides:
virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override;
virtual void SendChat (const AString & a_Message) override;
@@ -49,3 +53,20 @@ public:
+
+class cProtocol162 :
+ public cProtocol161
+{
+ typedef cProtocol161 super;
+
+public:
+ cProtocol162(cClientHandle * a_Client);
+
+protected:
+ // cProtocol161 overrides:
+ virtual void SendPlayerMaxSpeed(void) override;
+} ;
+
+
+
+
diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp
index 0b7887f5c..ec10eeb12 100644
--- a/source/Protocol/ProtocolRecognizer.cpp
+++ b/source/Protocol/ProtocolRecognizer.cpp
@@ -53,6 +53,7 @@ AString cProtocolRecognizer::GetVersionTextFromInt(int a_ProtocolVersion)
case PROTO_VERSION_1_5_0: return "1.5";
case PROTO_VERSION_1_5_2: return "1.5.2";
case PROTO_VERSION_1_6_1: return "1.6.1";
+ case PROTO_VERSION_1_6_2: return "1.6.2";
}
ASSERT(!"Unknown protocol version");
return Printf("Unknown protocol (%d)", a_ProtocolVersion);
@@ -684,6 +685,11 @@ bool cProtocolRecognizer::TryRecognizeProtocol(void)
m_Protocol = new cProtocol161(m_Client);
return true;
}
+ case PROTO_VERSION_1_6_2:
+ {
+ m_Protocol = new cProtocol162(m_Client);
+ return true;
+ }
}
m_Protocol = new cProtocol125(m_Client);
return true;
@@ -718,6 +724,7 @@ void cProtocolRecognizer::HandleServerPing(void)
case PROTO_VERSION_1_5_0:
case PROTO_VERSION_1_5_2:
case PROTO_VERSION_1_6_1:
+ case PROTO_VERSION_1_6_2:
{
// The server list ping now has 1 more byte of "magic". Mojang just loves to complicate stuff.
// http://wiki.vg/wiki/index.php?title=Protocol&oldid=3101#Server_List_Ping_.280xFE.29
diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h
index 682ac4b1d..96d03082d 100644
--- a/source/Protocol/ProtocolRecognizer.h
+++ b/source/Protocol/ProtocolRecognizer.h
@@ -18,8 +18,8 @@
// Adjust these if a new protocol is added or an old one is removed:
-#define MCS_CLIENT_VERSIONS "1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5, 1.5.1, 1.5.2, 1.6.1"
-#define MCS_PROTOCOL_VERSIONS "29, 39, 47, 49, 51, 60, 61, 73"
+#define MCS_CLIENT_VERSIONS "1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5, 1.5.1, 1.5.2, 1.6.1, 1.6.2"
+#define MCS_PROTOCOL_VERSIONS "29, 39, 47, 49, 51, 60, 61, 73, 74"
@@ -41,6 +41,7 @@ public:
PROTO_VERSION_1_5_0 = 60,
PROTO_VERSION_1_5_2 = 61,
PROTO_VERSION_1_6_1 = 73,
+ PROTO_VERSION_1_6_2 = 74,
PROTO_VERSION_NEXT,
PROTO_VERSION_LATEST = PROTO_VERSION_NEXT - 1, ///< Automatically assigned to the last protocol version, this serves as the default for PrimaryServerVersion