> 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/modules/internal-modules/commands-module.md).

# Commands Module

Thanks to this module you can create parent commands and every sub-command in separate classes.&#x20;

You can add a tab completer to the parent command, but it won't be required.

{% hint style="warning" %}
Module must be shaded to your JAR file
{% endhint %}

{% hint style="info" %}
{VERSION} - current version form GitHub releases section:\
<https://github.com/timsixth/MinigameAPI/releases>
{% endhint %}

{% tabs %}
{% tab title="Maven" %}

<pre class="language-xml"><code class="lang-xml"><strong>&#x3C;repositories>
</strong>  &#x3C;repository>
   &#x3C;id>jitpack.io&#x3C;/id>
   &#x3C;url>https://jitpack.io&#x3C;/url>
  &#x3C;/repository>
&#x3C;/repositories>

&#x3C;dependency>
   &#x3C;groupId>com.github.timsixth.MinigameAPI&#x3C;/groupId>
   &#x3C;artifactId>commands&#x3C;/artifactId>
   &#x3C;version>{VERSION}&#x3C;/version>
&#x3C;/dependency>
</code></pre>

{% endtab %}

{% tab title="Gradle" %}

```graphql
allprojects {
	repositories {
		maven { url 'https://jitpack.io' }
	}
}
  
 dependencies {
   implementation 'com.github.timsixth.MinigameAPI:commands:{VERSION}'    
}
```

{% endtab %}
{% endtabs %}

### How to register Commands Module?

```java
//Add new instance of Commands Module to registerModules method in configure method
    @Override
    protected LibraryConfiguration configure() {
        commandsModule = new CommandsModule(this);
        //or use your own command configurator
        commandsModule = new CommandsModule(this, new MyCommandConfigurator());
        return new LibraryConfiguration(this, getConfiguratorsInitializer())
                .builder()
                .setGameManager(new MyGameManager(this, settings, messages))
                .registerModules(commandsModule) //new way how to register command module
                .build();
    }
```

### How to define command configurator?

```java
public class MyCommandConfigurator extends DefaultCommandConfigurator {

    @Override
    public CommandConfiguration configure() {
        return CommandConfiguration.builder()
                .doNotHavePermissionMessage("No permission")
                .onlyPlayersMessage("Only players can use this command")
                .build();
    }
}
```
