-
-
Notifications
You must be signed in to change notification settings - Fork 57
Support of default value for parameter in Kotlin #357
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Current Behavior
When we use the annotations to set argument, the default value from kotlin declaration is not supported.
With the current system, the command bellow cannot be executed when the player doesn't define the values for args :
@CommandMethod("test [x] [y] [z]")
@CommandDescription("Test command")
suspend fun testCmd(
player: Player,
@Argument("x") x: Double = player.location.x,
@Argument("y") y: Double = player.location.y,
@Argument("z") z: Double = player.location.z
) {
println("parameters : $x $y $z")
}If the user doesn't add an argument, a null value will be used to set the arguments.
Effectively, in the @Argument, there is a String to define the default value, but in the most cases, it's not enough.
Expected Behavior
The command defined above can be used if the user writes :
/test
/test 1
/test 1 2
/test 1 2 3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request