summaryrefslogtreecommitdiffstats
path: root/src/Server.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-06-12 18:11:40 +0200
committerMattes D <github@xoft.cz>2016-06-27 20:51:52 +0200
commit257c5a1a54396a3610f63bf469d6cf50ec76aef5 (patch)
treef4609bd58206783c9809455f5567cc4aa2ef512d /src/Server.cpp
parentLuaState: Implemented proper locking for cCallback. (diff)
downloadcuberite-257c5a1a54396a3610f63bf469d6cf50ec76aef5.tar
cuberite-257c5a1a54396a3610f63bf469d6cf50ec76aef5.tar.gz
cuberite-257c5a1a54396a3610f63bf469d6cf50ec76aef5.tar.bz2
cuberite-257c5a1a54396a3610f63bf469d6cf50ec76aef5.tar.lz
cuberite-257c5a1a54396a3610f63bf469d6cf50ec76aef5.tar.xz
cuberite-257c5a1a54396a3610f63bf469d6cf50ec76aef5.tar.zst
cuberite-257c5a1a54396a3610f63bf469d6cf50ec76aef5.zip
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
}