diff --git a/EXILED/Exiled.Loader/Loader.cs b/EXILED/Exiled.Loader/Loader.cs index c174f9c92..8fde8bed3 100644 --- a/EXILED/Exiled.Loader/Loader.cs +++ b/EXILED/Exiled.Loader/Loader.cs @@ -26,7 +26,6 @@ namespace Exiled.Loader using Features; using Features.Configs; using Features.Configs.CustomConverters; - using MEC; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NodeDeserializers; @@ -116,13 +115,30 @@ public Loader() .Build(); /// - /// Loads all plugins. + /// Loads all plugins, both globals and locals. /// public static void LoadPlugins() { File.Delete(Path.Combine(Paths.Plugins, "Exiled.Updater.dll")); - foreach (string assemblyPath in Directory.GetFiles(Paths.Plugins, "*.dll")) + LoadPluginsFromDirectory(); + LoadPluginsFromDirectory(Server.Port.ToString()); + } + + /// + /// Load every plugin inside the given directory, if null it's default EXILED one (global). + /// + /// The sub-directory of the plugin - if null the default EXILED one will be used. + public static void LoadPluginsFromDirectory(string dir = null) + { + string path = Paths.Plugins; + if (dir is not null) + path = Path.Combine(path, dir); + + if (!Directory.Exists(path)) + Directory.CreateDirectory(path); + + foreach (string assemblyPath in Directory.GetFiles(path, "*.dll")) { Assembly assembly = LoadAssembly(assemblyPath);