diff --git a/IPA.Loader/Loader/Features/ConfigProviderFeature.cs b/IPA.Loader/Loader/Features/ConfigProviderFeature.cs index bceceaf7..61ab95f9 100644 --- a/IPA.Loader/Loader/Features/ConfigProviderFeature.cs +++ b/IPA.Loader/Loader/Features/ConfigProviderFeature.cs @@ -10,7 +10,7 @@ namespace IPA.Loader.Features private class DataModel { [JsonProperty("type", Required = Required.Always)] - public string TypeName; + public string TypeName = ""; } protected override bool Initialize(PluginMetadata meta, JObject featureData) diff --git a/IPA.Loader/Loader/Features/DefineFeature.cs b/IPA.Loader/Loader/Features/DefineFeature.cs index 1b08bfa5..9cba0a8c 100644 --- a/IPA.Loader/Loader/Features/DefineFeature.cs +++ b/IPA.Loader/Loader/Features/DefineFeature.cs @@ -13,7 +13,7 @@ namespace IPA.Loader.Features private class DataModel { [JsonProperty("type", Required = Required.Always)] - public string TypeName; + public string TypeName = ""; [JsonProperty("name", Required = Required.DisallowNull)] public string ActualName = null; @@ -40,7 +40,7 @@ namespace IPA.Loader.Features return PreregisterFeature(meta, data.Name); } - public override void AfterInit(PluginMetadata meta, object pluginInstance) + public override void BeforeInit(PluginMetadata meta) { Logger.features.Debug("Executing DefineFeature AfterInit"); diff --git a/IPA.Loader/Loader/Features/Feature.cs b/IPA.Loader/Loader/Features/Feature.cs index b2c37052..df70401e 100644 --- a/IPA.Loader/Loader/Features/Feature.cs +++ b/IPA.Loader/Loader/Features/Feature.cs @@ -42,7 +42,7 @@ namespace IPA.Loader.Features /// /// the plugin to be initialized /// whether or not to call the Init method - public virtual bool BeforeInit(PluginMetadata plugin) => true; + public virtual void BeforeInit(PluginMetadata plugin) { } /// /// Called after a plugin has been fully initialized, whether or not there is an `Init` method. This should never throw an exception. diff --git a/IPA.Loader/Loader/PluginLoader.cs b/IPA.Loader/Loader/PluginLoader.cs index cbec90b8..95038cfb 100644 --- a/IPA.Loader/Loader/PluginLoader.cs +++ b/IPA.Loader/Loader/PluginLoader.cs @@ -812,15 +812,14 @@ namespace IPA.Loader foreach (var feature in meta.Features) { - if (!feature.BeforeInit(meta)) + try { - Logger.loader.Warn( - $"Feature {feature?.FeatureName} denied plugin {meta.Name} from initializing! {feature?.InvalidMessage}"); - ignoredPlugins.Add(meta, new IgnoreReason(Reason.Feature) - { - ReasonText = $"Denied in {nameof(Feature.BeforeInit)} of feature {feature?.FeatureName}:\n\t{feature?.InvalidMessage}" - }); - return null; + feature.BeforeInit(meta); + } + catch (Exception e) + { + Logger.loader.Critical($"Feature errored in {nameof(Feature.BeforeInit)}:"); + Logger.loader.Critical(e); } } @@ -862,7 +861,8 @@ namespace IPA.Loader } catch (Exception e) { - Logger.loader.Critical($"Feature errored in {nameof(Feature.AfterInit)}: {e}"); + Logger.loader.Critical($"Feature errored in {nameof(Feature.AfterInit)}:"); + Logger.loader.Critical(e); } return exec;