diff --git a/Dalamud/Plugin/PluginManager.cs b/Dalamud/Plugin/PluginManager.cs index f0a041328..ba74a7167 100644 --- a/Dalamud/Plugin/PluginManager.cs +++ b/Dalamud/Plugin/PluginManager.cs @@ -29,6 +29,8 @@ namespace Dalamud.Plugin private readonly Type interfaceType = typeof(IDalamudPlugin); + private readonly List bannedPlugins; + /// /// Initializes a new instance of the class. /// @@ -48,6 +50,9 @@ namespace Dalamud.Plugin this.pluginConfigs = new PluginConfigurations(Path.Combine(Path.GetDirectoryName(dalamud.StartInfo.ConfigurationPath), "pluginConfigs")); + this.bannedPlugins = JsonConvert.DeserializeObject>( + File.ReadAllText(Path.Combine(this.dalamud.StartInfo.AssetDirectory, "UIRes", "bannedplugin.json"))); + // Try to load missing assemblies from the local directory of the requesting assembly // This would usually be implicit when using Assembly.Load(), but Assembly.LoadFile() doesn't do it... // This handler should only be invoked on things that fail regular lookups, but it *is* global to this appdomain @@ -317,6 +322,13 @@ namespace Dalamud.Plugin DalamudApiLevel = DalamudApiLevel, }; + if (this.bannedPlugins.Any(x => x.Name == pluginDef.InternalName && + x.AssemblyVersion == pluginDef.AssemblyVersion)) + { + Log.Error($"[PLUGINM] Banned plugin {pluginDef.InternalName} with {pluginDef.AssemblyVersion}"); + return false; + } + if (pluginDef.InternalName == "PingPlugin" && pluginDef.AssemblyVersion == "1.11.0.0") { Log.Error("Banned PingPlugin"); @@ -366,5 +378,12 @@ namespace Dalamud.Plugin this.UnloadPlugins(); this.LoadPlugins(); } + + private class BannedPlugin + { + public string Name { get; set; } + + public string AssemblyVersion { get; set; } + } } }