Declarative commands should have a flag/option argument type introduced.
Example implementation
val player by username()
val after by optionArgument<Date>()
val order by optionArgument<OrderByEnum>()
val boolean_option by flag()
("history" / player) {
+ after // Register the after argument
+ order // Alternatively call .withKeyValue(order) for java
runs<CommandSender> {
val records = Database.queryHistory(player)
.recordsAfterDate(after())
.orderBy(order())
.get()
if (records.isEmpty)
return@runs reply(!"&cThat user has no records.")
for (record in records) {
reply(!record)
}
}
} register this
This example command would be invoked like this:
/history MattMX --after 13/06/2024 --order date_asc --boolean-option
The argument type's format should be relatively customizable.
/history MattMX -after:13/06/2024 -order:date_asc -boolean-option
Declarative commands should have a flag/option argument type introduced.
Example implementation
This example command would be invoked like this:
The argument type's format should be relatively customizable.