Skip to content

Instantly share code, notes, and snippets.

@pschichtel
Created May 26, 2012 23:50
Show Gist options
  • Save pschichtel/2795651 to your computer and use it in GitHub Desktop.
Save pschichtel/2795651 to your computer and use it in GitHub Desktop.
full annotated command
@Alias( // specifies an alias command for this command
names = {"aliasCOmmand", "shorter"}, // the alias names, first is the main name
parentPath = {"root","sub", "subsub"} // optional: the command path under which the alias should be registered (default: root)
)
@Command( // annotates the method as a command and provides all needed information
names = {"mycommand", "myalias"}, // command names, first is the main name
min = 2, // optional: the minimum number of indexed parameters
max = 7, // optional: the maximum number of indexed parameters
permission = true, // optional: whether to check a permission (default: true)
permissionNode = "my.permission.node" // optional: the permission to check, will be generated if not given
usage = "my alternative", // optional: the command usage, will be generated if not given
description = "my description", // the command description, will be localized with the module as category
flags = { // optional: defines the flags this commands except
@Flag("a", "aaaaa"), // checking an undefined flag will throw an exception
@Flag("b", "blubber") // unnecessary flags given by the user will be ignored
},
params = { // optional: defines the named parameters this
@Param(
names = {"a", "along", "alonger"}, // parameter names, first is the main name
types = {User.class, String.class} // the value types
)
}
)
public void myCommand(CommandContext context)
{
// -> /myCommand <-<name|n> [-bla <yes|no>] <string>> [-a] [-b|--blub] <value> [value] [value]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment