summaryrefslogtreecommitdiffstats
path: root/src/Server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server.cpp')
-rw-r--r--src/Server.cpp43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/Server.cpp b/src/Server.cpp
index d1e53bfff..aa731cdd2 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -190,7 +190,7 @@ void cServer::PlayerDestroying(const cPlayer * a_Player)
bool cServer::InitServer(cIniFile & a_SettingsIni)
{
- m_Description = a_SettingsIni.GetValueSet("Server", "Description", "MCServer - in C++!").c_str();
+ m_Description = a_SettingsIni.GetValueSet("Server", "Description", "MCServer - in C++!");
m_MaxPlayers = a_SettingsIni.GetValueSetI("Server", "MaxPlayers", 100);
m_bIsHardcore = a_SettingsIni.GetValueSetB("Server", "HardcoreEnabled", false);
m_PlayerCount = 0;
@@ -275,7 +275,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
-int cServer::GetNumPlayers(void)
+int cServer::GetNumPlayers(void) const
{
cCSLock Lock(m_CSPlayerCount);
return m_PlayerCount;
@@ -476,7 +476,37 @@ void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallbac
a_Output.Finished();
return;
}
-
+ if (split[0] == "load")
+ {
+ if (split.size() > 1)
+ {
+ cPluginManager::Get()->LoadPlugin(split[1]);
+
+ return;
+ }
+ else
+ {
+ a_Output.Out("No plugin given! Command: load <pluginname>");
+ a_Output.Finished();
+ return;
+ }
+ }
+
+ 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 <pluginname>");
+ 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)
{
@@ -567,6 +597,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 <pluginname>", NULL, " - Adds and enables the specified plugin");
+ PlgMgr->BindConsoleCommand("unload <pluginname>", 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
@@ -615,14 +648,14 @@ void cServer::KickUser(int a_ClientID, const AString & a_Reason)
-void cServer::AuthenticateUser(int a_ClientID)
+void cServer::AuthenticateUser(int a_ClientID, const AString & a_Name, const AString & a_UUID)
{
cCSLock Lock(m_CSClients);
for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr)
{
if ((*itr)->GetUniqueID() == a_ClientID)
{
- (*itr)->Authenticate();
+ (*itr)->Authenticate(a_Name, a_UUID);
return;
}
} // for itr - m_Clients[]