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

Option to automatically parse quoted input #311

Open
jackah2 opened this issue Jan 22, 2021 · 2 comments
Open

Option to automatically parse quoted input #311

jackah2 opened this issue Jan 22, 2021 · 2 comments
Labels
core Related to the ACF Core feature

Comments

@jackah2
Copy link

jackah2 commented Jan 22, 2021

There is currently no parsing for input with quotes. For example, given /command "This should be one argument", the CommandExecutionContext args look like ["This, should, be, one, argument"]. Ideally, there would be an option in the command manager to pre-process arguments and group quoted one. In my example, this would resolve to a single arg, [This should be one argument]. This would be a solution to #253.

To expand on this, nested quotes could be escaped with \. Additionally, the method to set this behavior could take in a boolean to denote whether or not the quotes should remain in the parsed arguments.

@sqlongithub
Copy link

I mean you can just define a command like this

@CommandAlias("command")
public void onSomeCommand(CommandSender sender, String someArgument) {
	sender.sendMessage("Argument: "+someArgument)
}

and then if you did /command blah blah blah, you would get back
"Argument: blah blah blah"
Though I don't think it does that if you had a command with more arguments after that.

@stijnb1234
Copy link
Contributor

I mean you can just define a command like this

@CommandAlias("command")
public void onSomeCommand(CommandSender sender, String someArgument) {
	sender.sendMessage("Argument: "+someArgument)
}

and then if you did /command blah blah blah, you would get back
"Argument: blah blah blah"
Though I don't think it does that if you had a command with more arguments after that.

That's why this feature is useful. You can parse Strings with spaces between them, by using "".

@chickeneer chickeneer added feature core Related to the ACF Core labels Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to the ACF Core feature
Projects
None yet
Development

No branches or pull requests

4 participants