MCPcopy Create free account
hub / github.com/cuberite/cuberite / ExecuteConsoleCommand

Method ExecuteConsoleCommand

src/Server.cpp:441–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439
440
441void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output)
442{
443 AStringVector split = StringSplit(a_Cmd, " ");
444 if (split.empty())
445 {
446 return;
447 }
448
449 // Special handling: "stop" and "restart" are built in
450 if ((split[0].compare("stop") == 0) || (split[0].compare("restart") == 0))
451 {
452 return;
453 }
454
455 // "help" and "reload" are to be handled by MCS, so that they work no matter what
456 if (split[0] == "help")
457 {
458 PrintHelp(split, a_Output);
459 return;
460 }
461 if (split[0] == "reload")
462 {
463 cPluginManager::Get()->ReloadPlugins();
464 cRoot::Get()->ReloadGroups();
465 return;
466 }
467 if (split[0] == "reloadplugins")
468 {
469 cPluginManager::Get()->ReloadPlugins();
470 return;
471 }
472 if (split[0] == "reloadgroups")
473 {
474 cRoot::Get()->ReloadGroups();
475 a_Output.Out("Groups reloaded!");
476 a_Output.Finished();
477 return;
478 }
479
480 // There is currently no way a plugin can do these (and probably won't ever be):
481 if (split[0].compare("chunkstats") == 0)
482 {
483 cRoot::Get()->LogChunkStats(a_Output);
484 a_Output.Finished();
485 return;
486 }
487 #if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER)
488 if (split[0].compare("dumpmem") == 0)
489 {
490 LeakFinderXmlOutput Output("memdump.xml");
491 DumpUsedMemory(&Output);
492 return;
493 }
494
495 if (split[0].compare("killmem") == 0)
496 {
497 for (;;)
498 {

Callers

nothing calls this directly

Calls 9

StringSplitFunction · 0.85
DumpUsedMemoryFunction · 0.85
emptyMethod · 0.80
compareMethod · 0.80
ReloadPluginsMethod · 0.80
ReloadGroupsMethod · 0.80
LogChunkStatsMethod · 0.80
OutMethod · 0.45
FinishedMethod · 0.45

Tested by

no test coverage detected