summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-06 21:06:53 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-09 01:36:02 +0100
commit8d2ebf8e19e1556d256f75678d2272bb6739030f (patch)
tree4bac4e869999bbfe265374d2e614f41c3a9cbca4 /src
parentAdded switch case indent notice (diff)
downloadcuberite-8d2ebf8e19e1556d256f75678d2272bb6739030f.tar
cuberite-8d2ebf8e19e1556d256f75678d2272bb6739030f.tar.gz
cuberite-8d2ebf8e19e1556d256f75678d2272bb6739030f.tar.bz2
cuberite-8d2ebf8e19e1556d256f75678d2272bb6739030f.tar.lz
cuberite-8d2ebf8e19e1556d256f75678d2272bb6739030f.tar.xz
cuberite-8d2ebf8e19e1556d256f75678d2272bb6739030f.tar.zst
cuberite-8d2ebf8e19e1556d256f75678d2272bb6739030f.zip
Diffstat (limited to 'src')
-rw-r--r--src/ClientHandle.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 870568cdf..c677862eb 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -555,12 +555,25 @@ void cClientHandle::HandlePluginMessage(const AString & a_Channel, const AString
}
else if (a_Channel == "REGISTER")
{
+ if (HasPluginChannel(a_Channel))
+ {
+ SendPluginMessage("UNREGISTER", a_Channel);
+ return; // Can't register again if already taken - kinda defeats the point of plugin messaging!
+ }
+
RegisterPluginChannels(BreakApartPluginChannels(a_Message));
}
else if (a_Channel == "UNREGISTER")
{
UnregisterPluginChannels(BreakApartPluginChannels(a_Message));
}
+ else if (!HasPluginChannel(a_Channel))
+ {
+ // Ignore if client sent something but didn't register the channel first
+ LOGD("Player %s sent a plugin message on channel \"%s\", but didn't REGISTER it first", GetUsername().c_str(), a_Channel.c_str());
+ SendPluginMessage("UNREGISTER", a_Channel);
+ return;
+ }
cPluginManager::Get()->CallHookPluginMessage(*this, a_Channel, a_Message);
}