Skip to content

Repository files navigation

BGFX Example Plugin

A sample Java plugin for the BGFX Plugin System.

This project demonstrates how to create a BGFX plugin with:

  • Custom Android UI
  • Floating overlay button
  • Movable menus
  • Script execution through ScriptManager

Creating a Plugin

Every plugin must extend:

com.executor.plugin.Plugin

Example:

public class ExamplePlugin extends Plugin {

    @Override
    public void onLoad(PluginContext ctx) {

        Context context = ctx.getContext();

    }

}

The onLoad() method is called automatically when BGFX loads the plugin.


Plugin Context

Plugins receive a PluginContext.

@Override
public void onLoad(PluginContext ctx){

    Context context = ctx.getContext();

}

The Android context can be used to create:

  • Views
  • Buttons
  • Dialogs
  • Overlay windows
  • Custom menus

Building

Build the project:

./gradlew assembleRelease

After building, extract the generated dex file.

Example:

app/build/bin/classes.dex

Preparing The Plugin

After getting classes.dex:

  1. Rename it to your plugin name.

Example:

ExamplePlugin.dex
  1. Open the dex using:
  • MT Manager
  • NP Manager
  • Any dex editor
  1. Remove:
<!-- -->
com.executor

from the dex.

The final dex should only contain your plugin code.

Example:

com/example/bgfx/plugin/ExamplePlugin.class

Plugin JSON

Create:

ExamplePlugin.json

Content:

{
    "name": "ExamplePlugin",
    "main": "com.example.bgfx.plugin.ExamplePlugin"
}

The main value must match your plugin class.


Installing

Place files here:

/sdcard/BGFX/plugins/

Example:

/sdcard/BGFX/plugins/

├── Example.dex
└── Example.json

Dependencies

This project uses:

bgfxwrapper.jar

Provided APIs:

com.executor.plugin.Plugin
com.executor.plugin.PluginContext
com.executor.bgfxui.ScriptManager
com.executor.helpers.Welp

Notes

  • Class name must match the JSON main path
  • Dex name must match plugin name
  • Remove com.executor classes before distributing
  • Plugins can create Android interfaces
  • Plugins can execute BGFX Lua scripts

License

Free to modify and create your own BGFX plugins.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages