diff options
author | tycho <work.tycho@gmail.com> | 2015-10-04 00:23:28 +0200 |
---|---|---|
committer | tycho <work.tycho@gmail.com> | 2015-12-18 19:14:34 +0100 |
commit | 84bf48afaecf941005c89c3e0465bc6308634664 (patch) | |
tree | 8c485eb17e8e34e3ffe551ba3e891498b962455e /src/Protocol | |
parent | Broken (diff) | |
download | cuberite-84bf48afaecf941005c89c3e0465bc6308634664.tar cuberite-84bf48afaecf941005c89c3e0465bc6308634664.tar.gz cuberite-84bf48afaecf941005c89c3e0465bc6308634664.tar.bz2 cuberite-84bf48afaecf941005c89c3e0465bc6308634664.tar.lz cuberite-84bf48afaecf941005c89c3e0465bc6308634664.tar.xz cuberite-84bf48afaecf941005c89c3e0465bc6308634664.tar.zst cuberite-84bf48afaecf941005c89c3e0465bc6308634664.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol.h | 2 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 27 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.h | 2 | ||||
-rw-r--r-- | src/Protocol/Protocol18x.h | 2 |
4 files changed, 18 insertions, 15 deletions
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h index e3b64211f..303278fcc 100644 --- a/src/Protocol/Protocol.h +++ b/src/Protocol/Protocol.h @@ -208,7 +208,7 @@ protected: /** Sends a single packet contained within the cPacketizer class. The cPacketizer's destructor calls this to send the contained packet; protocol may transform the data (compression in 1.8 etc). */ - virtual void SendPacket(cPacketizer & a_Packet) = 0; + //virtual void SendPacket(cPacketizer & a_Packet) = 0; /** The logfile where the comm is logged, when g_ShouldLogComm is true */ cFile m_CommLogFile; diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index dd61e3e0c..1ed5a864b 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -2414,15 +2414,15 @@ void cProtocol172::SendPacket(cPacketizer & a_Packet) - -bool cProtocol172::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item) +*/ +cProtocol::cProtocolError cProtocol172::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item) { HANDLE_PACKET_READ(a_ByteBuffer, ReadBEInt16, Int16, ItemType); if (ItemType == -1) { // The item is empty, no more data follows a_Item.Empty(); - return true; + return cProtocolError::Success; } a_Item.m_ItemType = ItemType; @@ -2440,17 +2440,17 @@ bool cProtocol172::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item) AString Metadata; if (!a_ByteBuffer.ReadString(Metadata, MetadataLength)) { - return false; + return cProtocolError::PacketReadError; } ParseItemMetadata(a_Item, Metadata); - return true; + return cProtocolError::Success; } - +/* void cProtocol172::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata) { // Uncompress the GZIPped data: @@ -3171,15 +3171,17 @@ void cProtocol176::SendPlayerSpawn(const cPlayer & a_Player) -/* -void cProtocol176::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) + +cProtocol::cProtocolError cProtocol176::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer, ActionList & a_Action) { cServer * Server = cRoot::Get()->GetServer(); AString Motd = Server->GetDescription(); - int NumPlayers = Server->GetNumPlayers(); - int MaxPlayers = Server->GetMaxPlayers(); + //int NumPlayers = Server->GetNumPlayers(); + //int MaxPlayers = Server->GetMaxPlayers(); AString Favicon = Server->GetFaviconData(); - cRoot::Get()->GetPluginManager()->CallHookServerPing(*m_Client, Motd, NumPlayers, MaxPlayers, Favicon); + ADD_SIMPLE_ACTION(StatusRequest); + return cProtocolError::Success; + /*cRoot::Get()->GetPluginManager()->CallHookServerPing(*m_Client, Motd, NumPlayers, MaxPlayers, Favicon); // Version: Json::Value Version; @@ -3211,8 +3213,9 @@ void cProtocol176::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) cPacketizer Pkt(*this, 0x00); // Response packet Pkt.WriteString(Response); + */ } -*/ + diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h index e7ecc1650..8e85880b3 100644 --- a/src/Protocol/Protocol17x.h +++ b/src/Protocol/Protocol17x.h @@ -208,7 +208,7 @@ protected: void SendCompass(const cWorld & a_World); /** Reads an item out of the received data, sets a_Item to the values read. Returns false if not enough received data */ - virtual bool ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item); + virtual cProtocolError ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item); /** Parses item metadata as read by ReadItem(), into the item enchantments. */ void ParseItemMetadata(cItem & a_Item, const AString & a_Metadata); diff --git a/src/Protocol/Protocol18x.h b/src/Protocol/Protocol18x.h index 005791da9..5e5ee0cda 100644 --- a/src/Protocol/Protocol18x.h +++ b/src/Protocol/Protocol18x.h @@ -225,7 +225,7 @@ protected: //virtual void SendData(cByteBuffer & a_ByteBuffer, const char * a_Data, size_t a_Size) override; /** Sends the packet to the client. Called by the cPacketizer's destructor. */ - virtual void SendPacket(cPacketizer & a_Packet) override; + //virtual void SendPacket(cPacketizer & a_Packet) override; void SendCompass(const cWorld & a_World); |