From cf9e5ed66cbe55df801eaa2472eb5f3b847d349a Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Wed, 1 Feb 2023 17:30:09 +0100 Subject: [PATCH] Don't actually load disabled plugins lol --- src/controllers/plugins/PluginController.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controllers/plugins/PluginController.cpp b/src/controllers/plugins/PluginController.cpp index 6b4cfc2db..ceaf44fe4 100644 --- a/src/controllers/plugins/PluginController.cpp +++ b/src/controllers/plugins/PluginController.cpp @@ -140,6 +140,7 @@ void PluginController::load(QFileInfo index, QDir pluginDir, PluginMeta meta) auto pluginName = pluginDir.dirName(); auto plugin = std::make_unique(pluginName, l, meta, pluginDir); + for (const auto &[codename, other] : this->plugins_) { if (other->meta.name == meta.name) @@ -148,8 +149,13 @@ void PluginController::load(QFileInfo index, QDir pluginDir, PluginMeta meta) other->isDupeName = true; } } - this->plugins_.insert({pluginName, std::move(plugin)}); + if (!this->isEnabled(pluginName)) + { + qCInfo(chatterinoLua) << "Skipping loading" << pluginName << "(" + << meta.name << ") because it is disabled"; + return; + } int err = luaL_dofile(l, index.absoluteFilePath().toStdString().c_str()); if (err != 0)