summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol18x.cpp
diff options
context:
space:
mode:
authorSamuel Barney <sbarney@instructure.com>2016-07-18 22:39:11 +0200
committerSamuel Barney <samjbarney@gmail.com>2016-08-15 19:13:03 +0200
commit24e89bbb2c656224d06aed084b952bbc885e3914 (patch)
treeba75a68cce6ea868acba60ae08efeeccf003736d /src/Protocol/Protocol18x.cpp
parentSwitch out long download/compile links. (#3278) (diff)
downloadcuberite-24e89bbb2c656224d06aed084b952bbc885e3914.tar
cuberite-24e89bbb2c656224d06aed084b952bbc885e3914.tar.gz
cuberite-24e89bbb2c656224d06aed084b952bbc885e3914.tar.bz2
cuberite-24e89bbb2c656224d06aed084b952bbc885e3914.tar.lz
cuberite-24e89bbb2c656224d06aed084b952bbc885e3914.tar.xz
cuberite-24e89bbb2c656224d06aed084b952bbc885e3914.tar.zst
cuberite-24e89bbb2c656224d06aed084b952bbc885e3914.zip
Diffstat (limited to 'src/Protocol/Protocol18x.cpp')
-rw-r--r--src/Protocol/Protocol18x.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp
index ae9571f03..efd9cd5a9 100644
--- a/src/Protocol/Protocol18x.cpp
+++ b/src/Protocol/Protocol18x.cpp
@@ -16,6 +16,7 @@ Implements the 1.8.x protocol classes:
#include "Packetizer.h"
#include "../ClientHandle.h"
+#include "../ChannelManager.h"
#include "../Root.h"
#include "../Server.h"
#include "../World.h"
@@ -2483,10 +2484,24 @@ void cProtocol180::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer)
return;
}
- // Read the plugin message and relay to clienthandle:
+ // Read the rest of the message
+ cByteBuffer Buffer = a_ByteBuffer;
AString Data;
VERIFY(a_ByteBuffer.ReadString(Data, a_ByteBuffer.GetReadableSpace() - 1)); // Always succeeds
- m_Client->HandlePluginMessage(Channel, Data);
+
+ auto manager = cRoot::Get()->GetServer()->GetChannelManager();
+ // Register the client on the requested channels
+ if (Channel == "REGISTER")
+ {
+ manager->AddClientToChannels(*m_Client, Data);
+ }
+ else if (Channel == "UNREGISTER")
+ {
+ manager->RemoveClientFromChannels(*m_Client, Data);
+ }
+
+ // Call the channel message handler
+ manager->HandleChannelMessage(*m_Client, Channel, Buffer);
}
@@ -2738,10 +2753,7 @@ void cProtocol180::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const
}
LOG("Unhandled vanilla plugin channel: \"%s\".", a_Channel.c_str());
- // Read the payload and send it through to the clienthandle:
- AString Message;
- VERIFY(a_ByteBuffer.ReadString(Message, a_ByteBuffer.GetReadableSpace() - 1));
- m_Client->HandlePluginMessage(a_Channel, Message);
+ cRoot::Get()->GetServer()->GetChannelManager()->HandleChannelMessage(*m_Client, a_Channel, a_ByteBuffer);
}
@@ -3592,6 +3604,3 @@ void cProtocol180::WriteEntityProperties(cPacketizer & a_Pkt, const cEntity & a_
a_Pkt.WriteBEInt32(0); // NumProperties
}
-
-
-