Create Your First Plugin¶
Welcome to Allay! Allay provides a powerful plugin system that allows you to write plugins in various languages — Java, Kotlin, Scala and any JVM-based language. In this section, we'll walk you through creating a simple plugin in Java.
Prerequisites¶
Before you begin, make sure you have the following installed:
Project Templates¶
To quickly get started, you can use one of the available plugin templates:
In this guide, we will use JavaPluginTemplate.
Creating a New Project¶
- Go to the JavaPluginTemplate page.
- Click the
Use this templatebutton →Create a new repository. - Enter a name and description. We'll use
MyPluginas the name. - Click
Create repository.
Once the repository is created, you'll be redirected to its page. Clone the project to your local machine:
Initialize the Project¶
Open the project in IntelliJ IDEA and then open README.md. Follow the instructions in the file to initialize the project. After that,
reload the gradle project.
Tip
If you are not using JavaPluginTemplate, you'll need to write the plugin.json file manually:
When editing the plugin.json, there are a few things worth noting:
- Fields
api_version,description,websiteanddependenciescan be missing. - The
versionof your plugin must be a valid Semantic Version, otherwise the plugin won't be loaded. - The
api_versionof your plugin and theversionof entries independenciescan be an expression, and here are some examples: - Single version
-
1.2.3 - NPM Style
-
>1.2.2-1.1.1 || 1.2.3 - 2.0.0-1.1.*-~1.2.1-^1.1.1 - COCOAPODS Style
-
> 1.2.2-~> 1.2.1-<= 1.1.1 - IVY Style
-
1.2.+-(,1.8.9]-[0.2,1.4]
Run the Server with the Plugin¶
If you are using the AllayGradle plugin (which is already included in JavaPluginTemplate), you can run the server directly from the project:
Build the Plugin¶
To build the plugin, run:
The resulting file will be located at:
You can then copy it to the plugins directory of your Allay server and use it.
Now you're ready to create your own plugins for Allay! 🎉