Search in sources :

Example 1 with CommandContext

use of pl.themolka.arcade.command.CommandContext in project Arcade2 by ShootGame.

the class RepoFile method read.

public static RepoFile read(RepositoriesModule module, String[] file) {
    RepoFile repo = new RepoFile(module);
    for (int i = 0; i < file.length; i++) {
        String[] line = file[i].split(" ");
        String[] args = new String[0];
        if (line.length > 1) {
            System.arraycopy(line, 1, args, 0, line.length - 1);
        }
        Command command = repo.getQueries().getCommand(line[0]);
        if (command != null) {
            try {
                CommandContext context = CommandContext.parse(command, line[0], args);
                command.handleCommand(repo.getQueries().getConsole(), context);
            } catch (Throwable th) {
                module.getPlugin().getLogger().log(Level.SEVERE, "Could not handle repo query: " + command.getCommand(), th);
            }
        }
    }
    return repo;
}
Also used : CommandContext(pl.themolka.arcade.command.CommandContext) Command(pl.themolka.arcade.command.Command)

Aggregations

Command (pl.themolka.arcade.command.Command)1 CommandContext (pl.themolka.arcade.command.CommandContext)1