diff --git a/src/Artemis.Core/Plugins/Plugin.cs b/src/Artemis.Core/Plugins/Plugin.cs index bb6235ac0..ca8645a44 100644 --- a/src/Artemis.Core/Plugins/Plugin.cs +++ b/src/Artemis.Core/Plugins/Plugin.cs @@ -155,6 +155,19 @@ namespace Artemis.Core _profilers.Remove(profiler); } + /// + /// Gets an instance of the specified service using the plugins dependency injection container. + /// Note: To use parameters reference Ninject and use directly. + /// + /// The service to resolve. + /// An instance of the service. + public T Get() + { + if (Kernel == null) + throw new ArtemisPluginException("Cannot use Get before the plugin finished loading"); + return Kernel.Get(); + } + /// public override string ToString() { diff --git a/src/Artemis.Core/Plugins/PluginFeatureInfo.cs b/src/Artemis.Core/Plugins/PluginFeatureInfo.cs index 6806db862..507abacfa 100644 --- a/src/Artemis.Core/Plugins/PluginFeatureInfo.cs +++ b/src/Artemis.Core/Plugins/PluginFeatureInfo.cs @@ -50,7 +50,7 @@ namespace Artemis.Core else Icon = "Plugin"; } - + internal PluginFeatureInfo(Plugin plugin, PluginFeatureAttribute? attribute, PluginFeature instance) { if (instance == null) throw new ArgumentNullException(nameof(instance)); @@ -124,12 +124,13 @@ namespace Artemis.Core public bool AlwaysEnabled { get; } /// - /// Gets a boolean indicating whether the feature is enabled in persistent storage + /// Gets a boolean indicating whether the feature is enabled in persistent storage /// public bool EnabledInStorage => Entity.IsEnabled; /// /// Gets the feature this info is associated with + /// Note: if the associated is disabled /// public PluginFeature? Instance { @@ -137,12 +138,6 @@ namespace Artemis.Core internal set => SetAndNotify(ref _instance, value); } - /// - public List Prerequisites { get; } = new(); - - /// - public bool ArePrerequisitesMet() => Prerequisites.All(p => p.IsMet()); - internal PluginFeatureEntity Entity { get; } /// @@ -150,5 +145,14 @@ namespace Artemis.Core { return Instance?.Id ?? "Uninitialized feature"; } + + /// + public List Prerequisites { get; } = new(); + + /// + public bool ArePrerequisitesMet() + { + return Prerequisites.All(p => p.IsMet()); + } } } \ No newline at end of file