1
0

Added error message

This commit is contained in:
Julian Laubstein 2014-10-20 15:08:48 +02:00
parent 1a46feda43
commit c2560cc1be
2 changed files with 11 additions and 9 deletions

View File

@ -1525,15 +1525,6 @@ bool cPluginManager::DisablePlugin(const AString & a_PluginName)
bool cPluginManager::LoadPlugin(const AString & a_PluginName)
{
PluginMap map = GetAllPlugins();
for(auto plugin_entry : map)
{
if(plugin_entry.first == a_PluginName)
{
return false;
}
}
return AddPlugin(new cPluginLua(a_PluginName.c_str()));
}

View File

@ -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