Skip to content

Latest commit

 

History

History
78 lines (54 loc) · 1.97 KB

1_introduction.md

File metadata and controls

78 lines (54 loc) · 1.97 KB

Introduction

Basic Plugin Structure

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 here
  • unload(Context): called whenever your plugin is unloaded
  • start(Context): called whenever your plugin is started. Register commands or patches here
  • stop(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) {

    }
}

Plugin Template

A Plugin Template is available that has everything set up for you