# How to create addon?

Addon can be created like a simple Spigot plugin.

Addon has plugin.yml and addon.yml files.

**Getting started**

Add dependency

```xml
 <dependency>
    <groupId>com.github.timsixth.MinigameAPI</groupId>
   <artifactId>addons-api</artifactId>
   <version>version</version>
   <scope>provided</scope>
</dependency>
```

**How to create a main class?**

```java
public class MysMiniGameAddon extends MiniGameAddon {

    @Override
    public void onEnable() {
        super.onEnable(); //this is important
        //code...
    }
}
```

**How to register sub-commands?**

Addon can add sub-commands to two main minigame commands (Admin and player command).

```java
addAdminSubCommand(new MyAdminSubCommand());
addPlayerSubCommand(new MyPlayerSubCommand());
```

How to use the loaders class with an addon?

<pre class="language-java"><code class="lang-java"><strong>UserDBLoader userDbLoader = new UserDBLoader();
</strong><strong>
</strong>getLoaders().registerLoaders(userDbLoader);
getLoaders().load(userDbLoader);
</code></pre>

**How to create addon.yml?**

```yaml
name: 'MyMiniGameAddon' #required, it is the id of addon 
displayName: 'MyMiniGameAddon' #required, it will be shown on addon list 
repository: 'timsixth/MyMiniGameAddon' #optional, only to download from github 
```
