aikar/commands

@Syntax doesn't work

BrainRTP opened this issue · 7 comments

Hi! I set @Syntax annotation to method but if i write incorrect command i have template syntax command:

Usage: <c2>{command}</c2> <c3>{syntax}</c3>

Code:

@CommandAlias("eastereggs|ee")
public class ListCategoryCommand extends BaseCommand {

    @Subcommand("list")
    @CommandPermission("eastereggs.admin")
    @Syntax("[page]")
    @Description("List of easter eggs")
    public void onListCategory(Player player, @Optional @Single @Default("1") Integer page) {

Screenshot:
image

What's wrong?

idk about the syntax annotation, but arg1 -> page can be achieved by enabling params in the compiler, aka adding the --parameters compiler flag:
https://github.com/aikar/commands/wiki/Maven-Setup
https://github.com/aikar/commands/wiki/Gradle-Setup

idk about the syntax annotation, but arg1 -> page can be achieved by enabling params in the compiler, aka adding the --parameters compiler flag: https://github.com/aikar/commands/wiki/Maven-Setup https://github.com/aikar/commands/wiki/Gradle-Setup

about relocate for gradle shadow jar - these changes are present for me.
Whatever I specify in the annotation @Syntax - no such text is applied, only a template like "[arg1] [arg2]" is displayed

idk about the syntax annotation, but arg1 -> page can be achieved by enabling params in the compiler, aka adding the --parameters compiler flag:

compileJava {
    options.compilerArgs += ["-parameters"]
    options.fork = true
    options.forkOptions.executable = 'javac'
}
compileJava {
    options.compilerArgs += ["-parameters"]
    options.fork = true
    options.forkOptions.executable = 'javac'
}

Oh, my bad. I will try it

It's work. Thank you guys!

kyngs commented

BTW: You can also use the @Name annotation directly on the parameter to specify a custom argument name.

EDIT: OOF, I've mentioned someone, sorry.

@kyngs No problem! You're not the only one aha