Skip to content
This repository has been archived by the owner on Jan 19, 2025. It is now read-only.

[Exiled::Loader] Fix enabling plugins twice #2496

Merged
merged 2 commits into from
Apr 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Exiled.Loader/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,20 @@ public static IPlugin<IConfig> CreatePlugin(Assembly assembly)
public static void EnablePlugins()
{
List<IPlugin<IConfig>> toLoad = Plugins.ToList();
List<IPlugin<IConfig>> toLoad2 = new();

foreach (IPlugin<IConfig> plugin in toLoad.ToList())
foreach (IPlugin<IConfig> plugin in toLoad)
{
try
{
if (plugin.Name.StartsWith("Exiled") && plugin.Config.IsEnabled)
{
plugin.OnEnabled();
plugin.OnRegisteringCommands();
toLoad.Remove(plugin);
}
else
{
toLoad2.Add(plugin);
}

if (plugin.Config.Debug)
Expand All @@ -255,7 +259,7 @@ public static void EnablePlugins()
}
}

foreach (IPlugin<IConfig> plugin in toLoad)
foreach (IPlugin<IConfig> plugin in toLoad2)
{
try
{
Expand Down
Loading