summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-10-04 00:23:28 +0200
committertycho <work.tycho@gmail.com>2015-12-18 19:14:34 +0100
commit84bf48afaecf941005c89c3e0465bc6308634664 (patch)
tree8c485eb17e8e34e3ffe551ba3e891498b962455e
parentBroken (diff)
downloadcuberite-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
-rw-r--r--src/ClientHandle.cpp4
-rw-r--r--src/Protocol/Protocol.h2
-rw-r--r--src/Protocol/Protocol17x.cpp27
-rw-r--r--src/Protocol/Protocol17x.h2
-rw-r--r--src/Protocol/Protocol18x.h2
5 files changed, 20 insertions, 17 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index c25cbdf11..25a91fbd8 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -59,7 +59,7 @@ int cClientHandle::s_ClientCount = 0;
////////////////////////////////////////////////////////////////////////////////
// cClientHandle:
-#if 0
+
cClientHandle::cClientHandle(const AString & a_IPString, int a_ViewDistance) :
m_CurrentViewDistance(a_ViewDistance),
m_RequestedViewDistance(a_ViewDistance),
@@ -98,7 +98,7 @@ cClientHandle::cClientHandle(const AString & a_IPString, int a_ViewDistance) :
LOGD("New ClientHandle created at %p", static_cast<void *>(this));
}
-#endif
+
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);