commands icon indicating copy to clipboard operation
commands copied to clipboard

[Bug] Last argument doesn't consume rest of input

Open Rushmead opened this issue 7 years ago • 7 comments

As mentioned in the comments of #170 , the last argument doesn't consume the rest of the input. Example:

@CommandAlias("msg")
    public void onDefault(CommandIssuer sender, String username, String message) {
        AsyncDatabase.submit(() -> {
            UUID playerUUID = PlayerManager.getUUIDForUsername(username);
            if(!RedisManager.getPlayers().contains(playerUUID)){
                sender.sendMessage("That player is not online.");
                return;
            }
        });
    }

You should find that message doesn't get set at all.

Rushmead avatar Sep 10 '18 15:09 Rushmead

does it work if you use CommandSender instead of CommandISsuer?

aikar avatar Sep 11 '18 01:09 aikar

It does indeed work fine when using CommandSender instead of CommandIssuer!

Rushmead avatar Sep 11 '18 16:09 Rushmead

Is it possible to get this to work using CommandIssuer? We'd like to use CommandIssuer across commands instead.

Rushmead avatar Sep 19 '18 15:09 Rushmead

I am super busy ATM, so PR's welcome if you can figure out what's wrong.

You can use getCurrentCommandIssuer() in the command in mean time to obtain it.

aikar avatar Sep 19 '18 17:09 aikar