Skip to content

Commit

Permalink
feat: Refuse to load plugins already loaded/present in pluginList
Browse files Browse the repository at this point in the history
  • Loading branch information
3urobeat committed Jan 3, 2025
1 parent 1ddea95 commit 864468a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/data/fileStructure.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 7 additions & 1 deletion src/pluginSystem/loadPlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/3urobeat>
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 864468a

Please sign in to comment.