diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 438bb446e..2d61dc65c 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -2779,7 +2779,7 @@ internal class PluginInstallerWindow : Window, IDisposable var disabled = this.updateStatus == OperationStatus.InProgress || this.installStatus == OperationStatus.InProgress; // Disable everything if the plugin is outdated - disabled = disabled || (plugin.IsOutdated && !pluginManager.LoadAllApiLevels) || plugin.IsBanned; + disabled = disabled || (plugin.IsOutdated && !pluginManager.LoadAllApiLevels && !plugin.IsDev) || plugin.IsBanned; // Disable everything if the plugin is orphaned // Control will immediately be disabled once the plugin is disabled diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs index 64d3d8b93..ef2116669 100644 --- a/Dalamud/Plugin/Internal/PluginManager.cs +++ b/Dalamud/Plugin/Internal/PluginManager.cs @@ -1638,6 +1638,13 @@ internal class PluginManager : IInternalDisposableService loadPlugin = false; } + // Never automatically load outdated dev plugins. + if (devPlugin.IsOutdated) + { + loadPlugin = false; + Log.Warning("DevPlugin {Name} is outdated, not loading automatically - update DalamudPackager or SDK!", plugin.Manifest.InternalName); + } + plugin = devPlugin; } diff --git a/Dalamud/Plugin/Internal/PluginValidator.cs b/Dalamud/Plugin/Internal/PluginValidator.cs index 2ea98ef9e..9ca6b4efc 100644 --- a/Dalamud/Plugin/Internal/PluginValidator.cs +++ b/Dalamud/Plugin/Internal/PluginValidator.cs @@ -93,6 +93,9 @@ internal static class PluginValidator if (string.IsNullOrEmpty(plugin.Manifest.Author)) problems.Add(new NoAuthorProblem()); + if (plugin.IsOutdated) + problems.Add(new WrongApiLevelProblem()); + return problems; } @@ -192,4 +195,17 @@ internal static class PluginValidator /// public string GetLocalizedDescription() => "Your plugin does not have an author in its manifest."; } + + /// + /// Representing a problem where a plugin has an outdated API level. + /// + public class WrongApiLevelProblem : IValidationProblem + { + /// + public ValidationSeverity Severity => ValidationSeverity.Fatal; + + /// + public string GetLocalizedDescription() => "Your plugin specifies an outdated API level. " + + "Please update it by updating DalamudPackager or Dalamud.NET.Sdk."; + } } diff --git a/Dalamud/Plugin/Internal/Types/LocalPlugin.cs b/Dalamud/Plugin/Internal/Types/LocalPlugin.cs index c6bceed65..21713c458 100644 --- a/Dalamud/Plugin/Internal/Types/LocalPlugin.cs +++ b/Dalamud/Plugin/Internal/Types/LocalPlugin.cs @@ -319,7 +319,8 @@ internal class LocalPlugin : IDisposable if (this.manifest.ApplicableVersion < dalamud.StartInfo.GameVersion) throw new PluginPreconditionFailedException($"Unable to load {this.Name}, game is newer than applicable version {this.manifest.ApplicableVersion}"); - if (this.manifest.EffectiveApiLevel < PluginManager.DalamudApiLevel && !pluginManager.LoadAllApiLevels) + // We want to allow loading dev plugins with a lower API level than the current Dalamud API level, for ease of development + if (this.manifest.EffectiveApiLevel < PluginManager.DalamudApiLevel && !pluginManager.LoadAllApiLevels && !this.IsDev) throw new PluginPreconditionFailedException($"Unable to load {this.Name}, incompatible API level {this.manifest.EffectiveApiLevel}"); // We might want to throw here?