Despical / CommandFramework

A lightweight annotation based command system
https://spigotmc.org/resources/89933
GNU General Public License v3.0
23 stars 5 forks source link

[BUG] Tab completer arguments contains the sub-command part. #9

Closed Despical closed 6 months ago

Despical commented 6 months ago

Description of Issue

When we get the arguments using CommandArguments#getArguments from tab completers for sub-commands, the arguments array contains all arguments even they should not contain the sub-command part.

Steps to Reproduce

public class Main extends JavaPlugin {

    @Override
    public void onEnable() {
        CommandFramework commandFramework = new CommandFramework(this);
        commandFramework.registerCommands(this);
    }

    @Command(
        name = "test"
    )
    public void test() {
    }

    @Command(
        name = "test.arg"
    )
    public void testArg() {
    }

    @Completer(
        name = "test.arg"
    )
    public List<String> completer(CommandArguments arguments) {
        getLogger().info(String.join(", ", arguments.getArguments()));
        return null;
    }
}

Command Framework Version

1.3.9

Server Version

git-Purpur-1949 (MC: 1.19.4)*

Stack Trace/Log Files/Crash Reports

// Main command is test, test.arg is a sub-command.
[13:07:44 INFO]: [Test] arg, a, b, c
[13:07:47 INFO]: [Test] arg,