summaryrefslogtreecommitdiffstats
path: root/src/Server.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-10-21 16:55:22 +0200
committerHowaner <franzi.moos@googlemail.com>2014-10-21 16:55:22 +0200
commit44514e53fc5ad19e57688bed610f804b6d28be33 (patch)
tree224fce184f6d59739d77828889025467ecfd1edf /src/Server.cpp
parentAdded distance check. (diff)
parentUpdated ProtectionAreas (diff)
downloadcuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar.gz
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar.bz2
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar.lz
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar.xz
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar.zst
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.zip
Diffstat (limited to 'src/Server.cpp')
-rw-r--r--src/Server.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/Server.cpp b/src/Server.cpp
index 969ffd693..db3ab2ed4 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -196,7 +196,7 @@ void cServer::PlayerDestroying(const cPlayer * a_Player)
-bool cServer::InitServer(cIniFile & a_SettingsIni)
+bool cServer::InitServer(cIniFile & a_SettingsIni, bool a_ShouldAuth)
{
m_Description = a_SettingsIni.GetValueSet("Server", "Description", "MCServer - in C++!");
m_MaxPlayers = a_SettingsIni.GetValueSetI("Server", "MaxPlayers", 100);
@@ -247,7 +247,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
m_bIsConnected = true;
m_ServerID = "-";
- m_ShouldAuthenticate = a_SettingsIni.GetValueSetB("Authentication", "Authenticate", true);
+ m_ShouldAuthenticate = a_ShouldAuth;
if (m_ShouldAuthenticate)
{
MTRand mtrand1;
@@ -450,7 +450,7 @@ bool cServer::Start(void)
bool cServer::Command(cClientHandle & a_Client, AString & a_Cmd)
{
- return cRoot::Get()->GetPluginManager()->CallHookChat(a_Client.GetPlayer(), a_Cmd);
+ return cRoot::Get()->GetPluginManager()->CallHookChat(*(a_Client.GetPlayer()), a_Cmd);
}
@@ -491,6 +491,17 @@ void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallbac
{
if (split.size() > 1)
{
+ cPluginManager::PluginMap map = cPluginManager::Get()->GetAllPlugins();
+
+ for (auto plugin_entry : map)
+ {
+ if (plugin_entry.first == split[1])
+ {
+ a_Output.Out("Error! Plugin is already loaded!");
+ a_Output.Finished();
+ return;
+ }
+ }
a_Output.Out(cPluginManager::Get()->LoadPlugin(split[1]) ? "Plugin loaded" : "Error occurred loading plugin");
}
else