# Minigame setup

{% hint style="warning" %}
The library requires T-DataBasesAPI on Paper 1.20.6 and newer versions.

<https://github.com/timsixth/T-DataBasesAPI/releases>
{% endhint %}

Every minigame must extend MiniGame class.

```java
public class MyMinigamePlugin extends MiniGame 
```

If you want to set configurators overwrite **loadConfigurators** method

<pre class="language-java"><code class="lang-java"><strong>    @Override
</strong>    protected ConfiguratorsInitializer loadConfigurators() {
        return ConfiguratorsInitializer.builder()
                .setGameConfigurator(new MyGameConfigurator())
                .setPluginConfigurator(new MyPluginConfigurator())
                //.setCommandConfigurator(new MyCommandConfigurator()) 
                //old way how to register command module
                .build();
    }
</code></pre>

If you want to set GameManager or loader, other manager or factory, overwrite **configure** method

Init your own Game Manager.

You must set your own game manager, to define joining, leaving and drawing game.&#x20;

```java
    @Override
    protected LibraryConfiguration configure() {
        commandsModule = new CommandsModule(this);
        return new LibraryConfiguration(this, getConfiguratorsInitializer())
                .builder()
                .setGameManager(new MyGameManager())
                .registerModules(commandsModule) 
                //new way how to register command module
                .build();
    }
```

If you want to use config.yml or other configuration YAML set it in **initConfiguration** method\\

{% hint style="warning" %}
You must implement this method
{% endhint %}

```java
    @Override
    protected void initConfiguration() {
        getConfig().options().copyDefaults(true);
        saveConfig();
        //init your configuration classes 
    }
```

The whole implementation of the minigame main class

```java
public class MinigamePlugin extends MiniGame {

    @Override
    protected void onMiniGameEnable() {
        //define your on enable logic
    }
    
    @Override
    protected void initConfiguration() {
        getConfig().options().copyDefaults(true);
        saveConfig();
        //init your configuration classes 
    }
}
```
