From 864468a6573ef43880df6bee11f9728ee90b3acc Mon Sep 17 00:00:00 2001 From: 3urobeat <35304405+3urobeat@users.noreply.github.com> Date: Fri, 3 Jan 2025 14:20:58 +0100 Subject: [PATCH] feat: Refuse to load plugins already loaded/present in pluginList --- src/data/fileStructure.json | 2 +- src/pluginSystem/loadPlugins.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/data/fileStructure.json b/src/data/fileStructure.json index d53d5c17..4174e9ad 100644 --- a/src/data/fileStructure.json +++ b/src/data/fileStructure.json @@ -488,7 +488,7 @@ { "path": "src/pluginSystem/loadPlugins.js", "url": "https://raw.githubusercontent.com/3urobeat/steam-comment-service-bot/beta-testing/src/pluginSystem/loadPlugins.js", - "checksum": "d4be136478505123b8e25a28850ebfd6" + "checksum": "0046cfbd503dd367f234cebc084c94bc" }, { "path": "src/pluginSystem/pluginSystem.js", diff --git a/src/pluginSystem/loadPlugins.js b/src/pluginSystem/loadPlugins.js index 0ffc8e11..6ca75cb1 100644 --- a/src/pluginSystem/loadPlugins.js +++ b/src/pluginSystem/loadPlugins.js @@ -4,7 +4,7 @@ * Created Date: 2023-06-04 15:37:17 * Author: DerDeathraven * - * Last Modified: 2025-01-02 22:16:46 + * Last Modified: 2025-01-03 14:14:56 * Modified By: 3urobeat * * Copyright (c) 2023 - 2025 3urobeat @@ -54,6 +54,12 @@ function instantiatePlugin(pluginName) { */ PluginSystem.prototype._loadPlugin = async function(pluginPackageName) { + // Check if a plugin with this name is already loaded + if (this.pluginList[pluginPackageName]) { + logger("warn", `PluginSystem: Plugin '${pluginPackageName}' is already loaded! Skipping...`, false, false, null, true); // Force print now + return; + } + // Attempt to instantiate the plugin const instantiatedPlugin = instantiatePlugin.bind(this)(pluginPackageName);