summaryrefslogtreecommitdiffstats
path: root/src/Server.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-06-30 10:42:58 +0200
committerGitHub <noreply@github.com>2016-06-30 10:42:58 +0200
commit9af664dc739405726dd52f4fe7dce7b42f5ce18e (patch)
tree59bae2de637b5f3c629db8e55fb44a3106266709 /src/Server.cpp
parentSelf tests (#3242) (diff)
parentConverted cLuaState::cCallbackPtr into a UniquePtr. (diff)
downloadcuberite-9af664dc739405726dd52f4fe7dce7b42f5ce18e.tar
cuberite-9af664dc739405726dd52f4fe7dce7b42f5ce18e.tar.gz
cuberite-9af664dc739405726dd52f4fe7dce7b42f5ce18e.tar.bz2
cuberite-9af664dc739405726dd52f4fe7dce7b42f5ce18e.tar.lz
cuberite-9af664dc739405726dd52f4fe7dce7b42f5ce18e.tar.xz
cuberite-9af664dc739405726dd52f4fe7dce7b42f5ce18e.tar.zst
cuberite-9af664dc739405726dd52f4fe7dce7b42f5ce18e.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
}