-
Notifications
You must be signed in to change notification settings - Fork 4
Asphalt Plugin
In order to create an Asphalt plugin you have to create a plugin class.
First, the class needs to implement IModKitPlugin
.
Next we need to implement the methods required by the IModKitPlugin
.
To make the just created ModKitPlugin
an asphalt plugin we add the [AsphaltPlugin]
attribute to the class.
This may look like follows:
[AsphaltPlugin]
public class SomeAsphaltPlugin : IModKitPlugin
{
//defines the name of the plugin
public override string ToString()
{
return "SomeAsphaltPlugin";
}
//returns the status of the plugin
public string GetStatus()
{
return $"[v.1.0.0] Running...";
}
}
Asphalt also introduces different initialization phases, which allow different checks and initializations to be performed. Just add the respective method to your AsphaltPlugin.
public void OnPreEnable()
{
}
If you need something to do before other plugins.
public void OnEnable()
{
}
Here the entire initialization of the plugin can now be carried out, e.g. for the creation of objects.
Please use this method and not the constructor!
public void OnPostEnable()
{
}
Use this method if you need something performed after other plugins are initialized.
Asphalt also provides some special initialization phases - use if you know what you are doing
public static void OnPreInject()
{
}
Called directly before the configs etc are injected - This is the earliest initialization phase which you should use. (Somilar to a static constructor in your own plugin, but guaranteed that Asphalt is initialized)
public static void OnInject()
{
}
Called after injection
public static void OnRecipesInitialized()
{
}
If you want to remove Recipes with the RecipeRemover class, you have to do in during this special initialization phase.
- Asphalt Plugin
-
Event-Handling
- Listening
- Calling
- Cancelling
- Custom-Events
- Storage Management
- Permissions
- Command-Service
- Confirmable Commands