From c2560cc1be9a41dc80733fa8c55b00ec6e15a7f0 Mon Sep 17 00:00:00 2001 From: Julian Laubstein Date: Mon, 20 Oct 2014 15:08:48 +0200 Subject: Added error message --- src/Bindings/PluginManager.cpp | 9 --------- src/Server.cpp | 11 +++++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index ef9638339..0992ccec1 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -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())); } diff --git a/src/Server.cpp b/src/Server.cpp index 8e5755a75..67315c8cf 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -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 -- cgit v1.2.3