# Créer une Commande

### Structure

Une commande correspond à une classe. \
Pour une commande exécutée par un joueur de la partie qui a un rôle. \
La classe doit implémenter ICommandRole et être annoté de @RoleCommand.

<pre class="language-java"><code class="lang-java"><strong>@RoleCommand(key = "addon_key.roles.wild_child.command",
</strong>        roleKeys = RoleBase.WILD_CHILD,
        argNumbers = 1,
        requiredPower = true)
public class CommandWildChild implements ICommandRole {

    @Override
    public void execute(WereWolfAPI game, IPlayerWW playerWW, String[] args) {
    }
}

</code></pre>

###

Sinon pour une commande pouvant être accessible par des personnes en dehors de la partie, la classe doit implémenter ICommand et être annoté de @PlayerCommand.&#x20;

```java
@PlayerCommand(key = "addon_key.commands.player.ww_chat.command",
        descriptionKey = "addon_key.commands.player.ww_chat.description")
public class CommandWereWolfChat implements ICommand {

    @Override
    public void execute(WereWolfAPI game, Player player, String[] args) {
    }
}
```

Enfin pour une commande admin, la classe doit implémenter ICommand et être annoté de @AdminCommand.&#x20;

```java
@AdminCommand(key = "addon_key.commands.admin.stop.command",
        descriptionKey = "addon_key.commands.admin.stop.description",
        statesGame = {StateGame.START, StateGame.TRANSPORTATION, StateGame.GAME, StateGame.END},
        argNumbers = 0)
public class CommandStop implements ICommand {

    @Override
    public void execute(WereWolfAPI game, Player player, String[] args) {
    }
}
```
