summaryrefslogtreecommitdiffstats
path: root/src/Server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server.cpp')
-rw-r--r--src/Server.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/Server.cpp b/src/Server.cpp
index 5548e77d1..8405109de 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -607,18 +607,35 @@ void cServer::PrintHelp(const AStringVector & a_Split, cCommandOutputCallback &
void cServer::BindBuiltInConsoleCommands(void)
{
+ // Create an empty handler - the actual handling for the commands is performed before they are handed off to cPluginManager
+ class cEmptyHandler:
+ public cPluginManager::cCommandHandler
+ {
+ virtual bool ExecuteCommand(
+ const AStringVector & a_Split,
+ cPlayer * a_Player,
+ const AString & a_Command,
+ cCommandOutputCallback * a_Output = nullptr
+ ) override
+ {
+ return false;
+ }
+ };
+ auto handler = std::make_shared<cEmptyHandler>();
+
+ // Register internal commands:
cPluginManager * PlgMgr = cPluginManager::Get();
- PlgMgr->BindConsoleCommand("help", nullptr, "Shows the available commands");
- PlgMgr->BindConsoleCommand("reload", nullptr, "Reloads all plugins");
- PlgMgr->BindConsoleCommand("restart", nullptr, "Restarts the server cleanly");
- PlgMgr->BindConsoleCommand("stop", nullptr, "Stops the server cleanly");
- PlgMgr->BindConsoleCommand("chunkstats", nullptr, "Displays detailed chunk memory statistics");
- PlgMgr->BindConsoleCommand("load <pluginname>", nullptr, "Adds and enables the specified plugin");
- PlgMgr->BindConsoleCommand("unload <pluginname>", nullptr, "Disables the specified plugin");
- PlgMgr->BindConsoleCommand("destroyentities", nullptr, "Destroys all entities in all worlds");
+ PlgMgr->BindConsoleCommand("help", nullptr, handler, "Shows the available commands");
+ PlgMgr->BindConsoleCommand("reload", nullptr, handler, "Reloads all plugins");
+ PlgMgr->BindConsoleCommand("restart", nullptr, handler, "Restarts the server cleanly");
+ PlgMgr->BindConsoleCommand("stop", nullptr, handler, "Stops the server cleanly");
+ PlgMgr->BindConsoleCommand("chunkstats", nullptr, handler, "Displays detailed chunk memory statistics");
+ PlgMgr->BindConsoleCommand("load", nullptr, handler, "Adds and enables the specified plugin");
+ PlgMgr->BindConsoleCommand("unload", nullptr, handler, "Disables the specified plugin");
+ PlgMgr->BindConsoleCommand("destroyentities", nullptr, handler, "Destroys all entities in all worlds");
#if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER)
- PlgMgr->BindConsoleCommand("dumpmem", nullptr, " - Dumps all used memory blocks together with their callstacks into memdump.xml");
+ PlgMgr->BindConsoleCommand("dumpmem", nullptr, handler, " - Dumps all used memory blocks together with their callstacks into memdump.xml");
#endif
}