Provide convenient wrapper functions for registering new commands
CmdrDats opened this issue ยท 2 comments
Having a look at this : http://wiki.bukkit.org/Plugin_Tutorial#Commands
Unfortunately it seems we need to have the commands in the plugin.yml. meh. Not ideal, since it would have been nicer to be able to specify the commands directly at the plugin start
fn call.
That aside, my thinking is that we could have a (register-command "command-name" command-fn & param-types) function, which creates a proxy of the Bukkit CommandExecutor that can do a couple of checks, like arity (http://stackoverflow.com/questions/1696693/clojure-how-to-find-out-the-arity-of-function-at-runtime)
I imagine the & param-types to be something like :player :material :block :int :string or a combination thereof, so that we can immediately do extra automatic command checking, making sure that the arguments passed are valid without whole sets of convoluted if statements in every command function.
We could even have a param-type as a map, like {:type :int :min 1 :max 1000}, to do some more edge-case kind of checking. But perhaps in a later rendition of the register-command.
More commits in 39c29fa against this issue.