From 7b75aaea7c538f61518a60fe4af363383020e0bc Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 29 Jun 2013 15:30:05 +0000 Subject: Advanced RCON: Command output is sent to the RCON client. RCON authentication is now required before executing commands. Console command handlers now return two values, bool (IsHandled) and string (CommandOutput). API change: removed cRoot:ExecuteConsoleCommand(), added cRoot:QueueExecuteConsoleCommand(). API change: removed cPluginManager:ExecuteConsoleCommand(), use cRoot:QueueExecuteConsoleCommand() instead git-svn-id: http://mc-server.googlecode.com/svn/trunk@1631 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Server.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source/Server.cpp') diff --git a/source/Server.cpp b/source/Server.cpp index 7dac3ea18..67a02f626 100644 --- a/source/Server.cpp +++ b/source/Server.cpp @@ -21,6 +21,7 @@ #include "Tracer.h" #include "WebAdmin.h" #include "Protocol/ProtocolRecognizer.h" +#include "CommandOutput.h" #include "MersenneTwister.h" @@ -425,7 +426,7 @@ bool cServer::Command(cClientHandle & a_Client, AString & a_Cmd) -void cServer::ExecuteConsoleCommand(const AString & a_Cmd) +void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output) { AStringVector split = StringSplit(a_Cmd, " "); if (split.empty()) @@ -442,7 +443,8 @@ void cServer::ExecuteConsoleCommand(const AString & a_Cmd) // There is currently no way a plugin can do these (and probably won't ever be): if (split[0].compare("chunkstats") == 0) { - cRoot::Get()->LogChunkStats(); + cRoot::Get()->LogChunkStats(a_Output); + a_Output.Finished(); return; } #if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER) @@ -462,12 +464,14 @@ void cServer::ExecuteConsoleCommand(const AString & a_Cmd) } #endif - if (cPluginManager::Get()->ExecuteConsoleCommand(split)) + if (cPluginManager::Get()->ExecuteConsoleCommand(split, a_Output)) { + a_Output.Finished(); return; } - LOG("Unknown command, type 'help' for all commands.\n"); + a_Output.Out("Unknown command, type 'help' for all commands."); + a_Output.Finished(); } -- cgit v1.2.3