From 6951b68aaf208c7efdcc954fbc54420966fafa4a Mon Sep 17 00:00:00 2001 From: Julian Laubstein Date: Sat, 17 May 2014 18:38:33 +0200 Subject: Added load command in the cServer class --- src/Server.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index bfb1b1cbb..91bc6853e 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -476,6 +476,12 @@ void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallbac a_Output.Finished(); return; } + if (split[0] == "load" && !split[1].empty()) + { + cPluginManager::Get()->LoadPlugin(split[1]); + a_Output.Out("Plugin " + split[1] + " added and activated!"); + a_Output.Finished(); + } // There is currently no way a plugin can do these (and probably won't ever be): if (split[0].compare("chunkstats") == 0) -- cgit v1.2.3 From 19f4cd05470785a1afdc764b79db3777f62fe65d Mon Sep 17 00:00:00 2001 From: Julian Laubstein Date: Sat, 17 May 2014 19:39:16 +0200 Subject: Added load cmd --- src/Server.cpp | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 91bc6853e..8e222b743 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -476,13 +476,34 @@ void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallbac a_Output.Finished(); return; } - if (split[0] == "load" && !split[1].empty()) + if (split[0] == "load") { - cPluginManager::Get()->LoadPlugin(split[1]); - a_Output.Out("Plugin " + split[1] + " added and activated!"); - a_Output.Finished(); + if (split.size() > 1) + { + cPluginManager::Get()->LoadPlugin(split[1]); + return; + } + else + { + a_Output.Out("No plugin given! Command: load "); + a_Output.Finished(); + return; + } } - + /* + * TODO: Declare unload command + if (split[0] == "unload") + { + if (split.size() > 1) + { + + } + else + { + + } + } + */ // There is currently no way a plugin can do these (and probably won't ever be): if (split[0].compare("chunkstats") == 0) { @@ -573,6 +594,9 @@ void cServer::BindBuiltInConsoleCommands(void) PlgMgr->BindConsoleCommand("restart", NULL, " - Restarts the server cleanly"); PlgMgr->BindConsoleCommand("stop", NULL, " - Stops the server cleanly"); PlgMgr->BindConsoleCommand("chunkstats", NULL, " - Displays detailed chunk memory statistics"); + PlgMgr->BindConsoleCommand("load ", NULL, " - Adds and enables the specified plugin"); + PlgMgr->BindConsoleCommand("unload ", NULL, " - Disables the specified plugin"); + #if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER) PlgMgr->BindConsoleCommand("dumpmem", NULL, " - Dumps all used memory blocks together with their callstacks into memdump.xml"); #endif -- cgit v1.2.3 From cfd3c33dfa38c946151a1c4d3ba780f7733963c0 Mon Sep 17 00:00:00 2001 From: Julian Laubstein Date: Sun, 18 May 2014 17:16:02 +0200 Subject: Added unload command --- src/Server.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 8e222b743..e71e728a6 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -29,6 +29,7 @@ #include #include #include +#include extern "C" { #include "zlib/zlib.h" @@ -481,6 +482,7 @@ void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallbac if (split.size() > 1) { cPluginManager::Get()->LoadPlugin(split[1]); + return; } else @@ -490,20 +492,22 @@ void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallbac return; } } - /* - * TODO: Declare unload command + if (split[0] == "unload") { if (split.size() > 1) { - + cPluginManager::Get()->RemovePlugin(cPluginManager::Get()->GetPlugin(split[1])); + return; } else { - + a_Output.Out("No plugin given! Command: unload "); + a_Output.Finished(); + return; } } - */ + // There is currently no way a plugin can do these (and probably won't ever be): if (split[0].compare("chunkstats") == 0) { -- cgit v1.2.3 From 40ce737a7e372b5f3aef51cad7362a199351cb27 Mon Sep 17 00:00:00 2001 From: Julian Laubstein Date: Sun, 18 May 2014 17:30:21 +0200 Subject: removed the include --- src/Server.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index e71e728a6..aa731cdd2 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -29,7 +29,6 @@ #include #include #include -#include extern "C" { #include "zlib/zlib.h" -- cgit v1.2.3