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.
@RoleCommand(key = "addon_key.roles.wild_child.command",
        roleKeys = RoleBase.WILD_CHILD,
        argNumbers = 1,
        requiredPower = true)
public class CommandWildChild implements ICommandRole {
    @Override
    public void execute(WereWolfAPI game, IPlayerWW playerWW, String[] args) {
    }
}
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.
@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.
@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) {
    }
}Last updated
Was this helpful?