JorelAli / CommandAPI

A Bukkit/Spigot API for the command UI introduced in Minecraft 1.13

Home Page:https://commandapi.jorel.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No argument command aliases

Draycia opened this issue · comments

Describe the bug
When supplying an alias for a command, the alias is registered but the base command does not work. The server reports the alias (/balance in this instance) as a valid command, but when trying to run it I get the error Unknown Command

I should note that supplying arguments to the alias'd command does work. /balance Player works whereas /balance does not.

My code
This code reproduces the behavior:

    override val command = "bal"
    override val permission = CommandPermission.fromString("commands.balance")!!;
    override val aliases = arrayOf("balance");

    private fun run(sender: CommandSender, args: Array<Any>) {

    }

    private fun other(sender: CommandSender, args: Array<Any>) {

    }

    override fun registerCommand() {
        val args = linkedMapOf<String, Argument>();
        CommandAPI.getInstance().register(command, permission, aliases, args, ::run);

        args["Player"] = StringArgument();
        CommandAPI.getInstance().register(command, permission, aliases, args, ::other);
    }

Expected behavior
The base command with no args is successfully run either through the alias or the non alias.

Screenshots
https://i.imgur.com/5CTg18o.png
The first line is me running /bal and the second is me running /balance

Fixed in 2.1 release