# Your First Plugin

Plugins are a lightweight way of integrating features to Tachyon, plugins can use the API to modify quite literally any aspect of the server.

1. Start by creating a new Java/Kotlin project, you can use any build system you want, we will use Gradle Groovy for this example.
2. Inside your build systems internal files, define our repository and depend on the Tachyon API.\
   &#x20;`compileOnly "net.tachyon:api:VERSION"`

&#x20;There are two ways of appending metadata to your plugin jar so the plugin can be discovered by Tachyon on startup, manual and automatic. We strongly suggest using the automatic method.

{% tabs %}
{% tab title="Manual" %}
In the resources directory for your project, define a `plugin.json` file. These work similarly to how you would define a `plugin.yml` file in a Bukkit plugin, or an `extension.json` in a Minestom extension.\
\
In your `plugin.json` file, create a couple entries, these act like metadata for your plugin allowing Tachyon to read and discover your plugin before loading it and its dependencies.

```json
{
"name": "ExamplePluginName,
"description": "My first plugin for Tachyon!"
"authors": [
  "Me",
  "Myself",
  "I"
],
"version": "1.0.0",
"main": "my.plugins.main.class"
}
```

{% endtab %}

{% tab title="Automatic" %}
Once you have created your plugin class, annotate it with @PluginData and add your plugin info there\ <br>

```java
@PluginData(
        name = "ExamplePlugin",
        version = "1.0.0",
        description = "An example plugin",
        authors = {"Tachyon"}
)
public class ExamplePlugin extends Plugin {

    @Override
    public void onEnable() {
        getLogger().info("ExamplePlugin enabled!");
    }
}
```

THIS STEP IS CRUTIAL: \
\
Where you specified a dependency for the API, make sure you specify tachyon as an annotation processor\
`annotationProcessor("net.tachyon:api:VERSION")`\
\
`After compiling your plugin, the ```plugin.json``` should be automatically generated and you wont have to implement it.`
{% endtab %}
{% endtabs %}
