Every plugin must extend the plugin class and be annotated with the @AliucordPlugin annotation
Plugins have a few life cycle methods:
load(Context)
: called whenever your plugin is loaded. Do initialisation hereunload(Context)
: called whenever your plugin is unloadedstart(Context)
: called whenever your plugin is started. Register commands or patches herestop(Context)
: called whenever your plugin is stopped. Unregister commands or patches here
Thus, they are called in the order load -> start -> stop -> unload
. If load or start throws an exception, it will be logged to the debug log
and your plugin will be unloaded.
Additionally, every plugin class has access to a CommandsAPI to register commands, a PatcherAPI to add patches and a SettingsAPI to persist data. You may also register a custom SettingsTab
A minimal plugin boilerplate looks like this:
Java
package com.yourname.plugins;
import android.content.Context;
import com.aliucord.annotations.AliucordPlugin;
import com.aliucord.entities.Plugin;
@SuppressWarnings("unused")
@AliucordPlugin
public class MyPlugin extends Plugin {
@Override
public void start(Context context) {
}
@Override
public void stop(Context context) {
}
}
Kotlin
package com.yourname.plugins
import android.content.Context
import com.aliucord.annotations.AliucordPlugin
import com.aliucord.entities.Plugin
@SuppressWarnings("unused")
@AliucordPlugin
class MyPlugin : Plugin() {
override fun start(context: Context) {
}
override fun stop(context: Context) {
}
}
A Plugin Template is available that has everything set up for you