Class Feature
The root interface for a mod Feature.
Inherited Members
Namespace: IPA.Loader.Features
Assembly: IPA.Loader.dll
Syntax
public abstract class Feature
Remarks
Avoid storing any data in any subclasses. If you do, it may result in a failure to load the feature.
Properties
| Improve this Doc View SourceInvalidMessage
The message to be logged when the feature is not valid for a plugin. This should also be set whenever either BeforeInit(PluginMetadata) returns false.
Declaration
public virtual string InvalidMessage { get; protected set; }
Property Value
Type | Description |
---|---|
String | the message to show when the feature is marked invalid |
Methods
| Improve this Doc View SourceAfterDisable(PluginMetadata)
Called after a plugin with this feature appplied is disabled.
Declaration
public virtual void AfterDisable(PluginMetadata plugin)
Parameters
Type | Name | Description |
---|---|---|
PluginMetadata | plugin | the plugin that was disabled |
AfterInit(PluginMetadata)
Called after a plugin has been fully initialized, whether or not there is an Init
method. This should never throw an exception.
Declaration
public virtual void AfterInit(PluginMetadata plugin)
Parameters
Type | Name | Description |
---|---|---|
PluginMetadata | plugin | the plugin that was just initialized |
AfterInit(PluginMetadata, Object)
Called after a plugin has been fully initialized, whether or not there is an Init
method. This should never throw an exception.
Declaration
public virtual void AfterInit(PluginMetadata plugin, object pluginInstance)
Parameters
Type | Name | Description |
---|---|---|
PluginMetadata | plugin | the plugin that was just initialized |
Object | pluginInstance | the instance of the plugin being initialized |
BeforeInit(PluginMetadata)
Called before a plugin's Init
method is called. This will not be called if there is no Init
method. This should never throw an exception. An exception will abort the loading of the plugin with an error.
Declaration
public virtual void BeforeInit(PluginMetadata plugin)
Parameters
Type | Name | Description |
---|---|---|
PluginMetadata | plugin | the plugin to be initialized |
Initialize(PluginMetadata, JObject)
Initializes the feature with the data provided in the definition.
Declaration
protected abstract bool Initialize(PluginMetadata meta, JObject featureData)
Parameters
Type | Name | Description |
---|---|---|
PluginMetadata | meta | the metadata of the plugin that is being prepared |
Newtonsoft.Json.Linq.JObject | featureData | the data provided with the feature |
Returns
Type | Description |
---|---|
Boolean | true if the feature is valid for the plugin, false otherwise |
Remarks
This gets called AFTER your Init
method, but BEFORE the target's Init
method. If it is applied to the defining plugin, BeforeInit
is not called.
Returning false does not prevent the plugin from being loaded. It simply prevents the feature from being used.