Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subcommands do not parse arguments correctly #9

Open
TrueReassembly opened this issue Jul 24, 2023 · 1 comment
Open

Subcommands do not parse arguments correctly #9

TrueReassembly opened this issue Jul 24, 2023 · 1 comment

Comments

@TrueReassembly
Copy link

If you write a subcommand with a single string parameter (other than the required player parameter), that argument will always be the subcommand.

For Example, for the main command "foo" with subcommand "bar":

fun bar(executor: Player, argument: String) {
    executor.sendMessage(argument)
}

Running the command /foo bar fizz will output bar instead of the expected "fizz"

@flowergardn
Copy link

This can be replicated like so:

fun foo(executor: Player) {
    executor.sendMessage("foo")
}

fun bar(executor: Player, text: String) {
    executor.sendMessage("bar")
    executor.sendMessage("string: $text")
}

However, it works when this is done:

fun foo(executor: Player) {
    executor.sendMessage("foo")
}

fun bar(executor: Player) {
    executor.sendMessage("bar")
}

fun bar(executor: Player, text: String) {
    executor.sendMessage("bar")
    executor.sendMessage("string: $text")
}

Could be a thing to look out for within the upcoming rewrite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants