/// <summary>
/// Loads the plugins found by the plugin factory.
/// </summary>
/// <param name="settings">The settings to load plugins with.</param>
internal void LoadPlugins(ServerSpawnData.PluginsSettings settings)
{
Type[] types = pluginFactory.GetAllSubtypes(typeof(Plugin));
foreach (Type type in types)
{
var s = settings.Plugins.FirstOrDefault(p => p.Type == type.Name);
PluginLoadData loadData = new PluginLoadData(
type.Name,
server,
s?.Settings ?? new NameValueCollection(),
logManager.GetLoggerFor(type.Name),
#if PRO
metricsManager.GetMetricsCollectorFor(type.Name),
#endif
dataManager.GetResourceDirectory(type.Name)
);
if (s?.Load ?? settings.LoadByDefault)
{
LoadPlugin(type.Name, type, loadData, null, true);
}
}
}