From f36b00f4d496cb90c8c77d0e6ae570502f3199ae Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 13 May 2015 18:31:01 +0200 Subject: All in-game commands go through the OnExecuteCommand hook. Everything that has a slash at the beginning, doesn't matter if it is a registered command or not. --- src/Bindings/PluginManager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 15bea22bd..db2493955 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -1445,6 +1445,13 @@ cPluginManager::CommandResult cPluginManager::HandleCommand(cPlayer & a_Player, if (cmd == m_Commands.end()) { // Command not found + // If it started with a slash, ask the plugins if they still want to handle it: + if (!a_Command.empty() && (a_Command[0] == '/')) + { + CommandResult Result = crUnknownCommand; + CallHookExecuteCommand(&a_Player, Split, a_Command, Result); + return Result; + } return crUnknownCommand; } -- cgit v1.2.3 From 2cdc2a16e4631c541f0b520f547621a23fe90baa Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 13 May 2015 18:45:29 +0200 Subject: Fixed chat message manipulation by plugins. Plugins, in their OnChat hook, can change the chat message sent by a player. --- src/ClientHandle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 7117229f7..c8ccc1cf5 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1473,7 +1473,7 @@ void cClientHandle::HandleChat(const AString & a_Message) Color.clear(); } Msg.AddTextPart(AString("<") + m_Player->GetName() + "> ", Color); - Msg.ParseText(a_Message); + Msg.ParseText(Message); Msg.UnderlineUrls(); m_Player->GetWorld()->BroadcastChat(Msg); } -- cgit v1.2.3