> For the complete documentation index, see [llms.txt](https://timsixths-plugins.gitbook.io/minigameapi-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://timsixths-plugins.gitbook.io/minigameapi-docs/minigameapi-1.x/minigame-setup.md).

# 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 
```

You must implement two abstract methods getPlayerCommand and getAdminCommand.

These two methods are important to the addon system.

```java
    @Override
    public ParentCommand getPlayerCommand() {
        return new PlayerCommand();
    }

    @Override
    public ParentCommand getAdminCommand() {
        return new AdminCommand();
    }
```

Sets two configurators before you call super.onEnable.&#x20;

1. Game configurator
2. Plugin configurator

```java
setDefaultGameConfigurator(new MyGameConfigurator());
setDefaultPluginConfigurator(new MyPluginConfigurator());
```

If you don't set these configurators, will apply default configurators.&#x20;

```java
super.onEnable(); //don't forget about this, it's very important
```

Set your command configurator:

```java
setDefaultCommandConfigurator(new MyCommandConfigurator());
```

Init your own Game Manager.

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

```java
setGameManager(new MyGameManager();
```

Register default listeners:

This method is important to define default listeners system

```java
super.registerGameListeners();
```

On the end call loadAll method to load all data to default systems.&#x20;

```java
getLoaders().loadAll();
```

The whole implementation of the minigame main class

```java
public class MinigamePlugin extends MiniGame {

    @Override
    public void onEnable() { 
        setDefaultGameConfigurator(new MyGameConfigurator());
        setDefaultPluginConfigurator(new MyPluginConfigurator());

        super.onEnable(); //don't forget about this, it's very important

        setDefaultCommandConfigurator(new MyCommandConfigurator(messages));
  
        setGameManager(new MyGameManager();

        super.registerGameListeners();

        getLoaders().loadAll();
    }

    @Override
    public ParentCommand getPlayerCommand() {
        return new TheTagCommand();
    }

    @Override
    public ParentCommand getAdminCommand() {
        return new AdminTheTagCommand();
    }
    
}
```
