Class CommandArgument.Builder
java.lang.Object
dev.ua.theroer.magicutils.commands.CommandArgument.Builder
- Enclosing class:
CommandArgument
Builder for CommandArgument.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the CommandArgument instance.compareMode(CompareMode mode) Sets comparison strategy for permission checks.contextArgs(String... contextArgs) Adds names of arguments whose parsed values should be available as context for suggestions.defaultValue(String defaultValue) Sets the default value for the argument.greedy()Marks this argument as greedy (consume remaining input).includeArgumentSegment(boolean include) Controls whether to include ".argument." segment in generated node.Explicitly mark that a permission annotation exists even if value is empty.Defines named options for this argument.Defines named options for this argument.optional()Sets the argument as optional.permission(String permission) Sets the required permission for the argument.permissionCondition(PermissionConditionType condition) Sets structured permission condition.permissionCondition(String condition) Deprecated.permissionConditionArgs(String[] args) Sets arguments used in the permission condition.permissionDefault(MagicPermissionDefault defaultValue) Sets default permission state.permissionMessage(String message) Sets the permission denied message for the argument.permissionNode(String node) Overrides generated permission node segment.sender(AllowedSender[] allowed) Mark this parameter as the executing sender and restrict allowed sender types.suggestionHost(Object suggestionHost) Sets the object on which@Suggest("methodName")provider methods resolve.suggestions(String... suggestions) Adds suggestions for the argument.suggestions(List<String> suggestions) Adds suggestions for the argument.
-
Constructor Details
-
Builder
-
-
Method Details
-
optional
-
defaultValue
Sets the default value for the argument.- Parameters:
defaultValue- the default value- Returns:
- this builder
-
suggestions
Adds suggestions for the argument.- Parameters:
suggestions- the suggestions- Returns:
- this builder
-
suggestions
Adds suggestions for the argument.- Parameters:
suggestions- the suggestions list- Returns:
- this builder
-
suggestionHost
Sets the object on which@Suggest("methodName")provider methods resolve. Used when a carrier is mounted/merged into another root so the suggestion methods still resolve against the original carrier instance rather than the registered wrapper command.- Parameters:
suggestionHost- the carrier instance, ornull- Returns:
- this builder
-
permission
Sets the required permission for the argument.- Parameters:
permission- the permission string- Returns:
- this builder
-
permissionCondition
Sets structured permission condition.- Parameters:
condition- condition type- Returns:
- this builder
-
permissionConditionArgs
Sets arguments used in the permission condition.- Parameters:
args- argument names- Returns:
- this builder
-
compareMode
Sets comparison strategy for permission checks.- Parameters:
mode- compare mode- Returns:
- this builder
-
permissionNode
Overrides generated permission node segment.- Parameters:
node- custom node- Returns:
- this builder
-
includeArgumentSegment
Controls whether to include ".argument." segment in generated node.- Parameters:
include- true to include, false to omit- Returns:
- this builder
-
permissionDefault
Sets default permission state.- Parameters:
defaultValue- default permission- Returns:
- this builder
-
markPermissionDeclared
Explicitly mark that a permission annotation exists even if value is empty.- Returns:
- this builder
-
permissionCondition
Deprecated.Sets the permission condition for the argument.- Parameters:
condition- the permission condition- Returns:
- this builder
-
permissionMessage
Sets the permission denied message for the argument.- Parameters:
message- the permission message- Returns:
- this builder
-
greedy
Marks this argument as greedy (consume remaining input).- Returns:
- this builder
-
sender
Mark this parameter as the executing sender and restrict allowed sender types.- Parameters:
allowed- allowed sender kinds- Returns:
- this builder
-
option
Defines named options for this argument.- Parameters:
shortNames- short option names without "-" prefixlongNames- long option names without "--" prefix- Returns:
- this builder
-
option
Defines named options for this argument.- Parameters:
shortNames- short option names without "-" prefixlongNames- long option names without "--" prefixflag- whether this option is a flag- Returns:
- this builder
-
contextArgs
Adds names of arguments whose parsed values should be available as context for suggestions.- Parameters:
contextArgs- the names of context arguments- Returns:
- this builder
-
build
-