Provide convenient wrapper functions for registering new commands #7

Closed
CmdrDats opened this Issue Dec 4, 2012 · 2 comments

Comments

Projects
None yet
1 participant
Owner

CmdrDats commented Dec 4, 2012

No description provided.

Owner

CmdrDats commented Dec 5, 2012

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.

Owner

CmdrDats commented Dec 7, 2012

More commits in 39c29fa against this issue.

CmdrDats closed this in 599a66e Dec 8, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment