mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
allow loading dev plugins with the wrong API level, but add a validation error
This commit is contained in:
parent
d628be9536
commit
7283e634e9
4 changed files with 26 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
|||
/// <inheritdoc/>
|
||||
public string GetLocalizedDescription() => "Your plugin does not have an author in its manifest.";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Representing a problem where a plugin has an outdated API level.
|
||||
/// </summary>
|
||||
public class WrongApiLevelProblem : IValidationProblem
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public ValidationSeverity Severity => ValidationSeverity.Fatal;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string GetLocalizedDescription() => "Your plugin specifies an outdated API level. " +
|
||||
"Please update it by updating DalamudPackager or Dalamud.NET.Sdk.";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue