From 34b3c13404c466c8f64d198dce914a1e3fa094c2 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 15 Feb 2013 13:00:59 +0000 Subject: Plugins can now bind console commands FS #300 Most console commands are now implemented in the Core plugin. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1214 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Root.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'source/Root.cpp') diff --git a/source/Root.cpp b/source/Root.cpp index 72003ca72..41788ff8d 100644 --- a/source/Root.cpp +++ b/source/Root.cpp @@ -73,7 +73,7 @@ void cRoot::InputThread(void * a_Params) { std::string Command; std::getline(std::cin, Command); - self.ServerCommand(Command); + self.ExecuteConsoleCommand(Command); } } @@ -149,7 +149,7 @@ void cRoot::Start(void) LoadWorlds(); LOG("Loading plugin manager..."); - m_PluginManager = new cPluginManager(); // This should be last + m_PluginManager = new cPluginManager(); m_PluginManager->ReloadPluginsNow(); LOG("Loading MonsterConfig..."); @@ -348,11 +348,11 @@ bool cRoot::ForEachWorld(cWorldListCallback & a_Callback) -void cRoot::TickWorlds( float a_Dt ) +void cRoot::TickWorlds(float a_Dt) { - for( WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr ) + for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr) { - itr->second->Tick( a_Dt ); + itr->second->Tick(a_Dt); } } @@ -360,10 +360,12 @@ void cRoot::TickWorlds( float a_Dt ) -void cRoot::ServerCommand(const AString & a_Cmd) +void cRoot::ExecuteConsoleCommand(const AString & a_Cmd) { - LOG("Server console command: \"%s\"", a_Cmd.c_str()); - m_Server->ServerCommand(a_Cmd); + LOG("Executing console command: \"%s\"", a_Cmd.c_str()); + m_Server->ExecuteConsoleCommand(a_Cmd); + + // Some commands are built-in: if (a_Cmd == "stop") { m_bStop = true; @@ -491,6 +493,15 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac +AString cRoot::GetProtocolVersionTextFromInt(int a_ProtocolVersion) +{ + return cProtocolRecognizer::GetVersionTextFromInt(a_ProtocolVersion); +} + + + + + void cRoot::LogChunkStats(void) { int SumNumValid = 0; -- cgit v1.2.3