Java class for easy command management

Discussion in 'Resources' started by Twisol, Jan 23, 2011.

Thread Status:
Not open for further replies.
  1. Offline


    I just got started with Bukkit today, and I have to say, it's really nice so far. Very clean. :) It took me a bit longer than I expected to learn how to set up commands though, and I felt like streamlining the process, so I devised a way to write a command's implementation in its own class, and reflectively load that class from the plugin.yml file when the server is started.

    The gist includes ICommandable (which command implementations must, er, implement), CommandManager (which manages these implementations), and a "Tester" test plugin. What I like about this is that the only place that needs to explicitly know about the commands are the plugin.yml file and the commands themselves.

    I thought I'd share it in case someone else found it useful. Let me know what you think! :D

    EDIT: Probably should have put this in Plugin Development, if that's the case could someone move it there for me? Thanks >_>
    hoffm59 likes this.
  2. Offline


    Moved to appropriate forum :)
  3. Offline


    It appears I arrived at the same conclusion you did on command handling. Reflective dispatch of command handlers is much cleaner. I've posted a question related to the long-term usage of YML nodes for command-specific configuration but it doesn't seem to have garnered much interest.
  4. Offline


    Based on what I've heard, I think they're going to be overhauling how commands work, so there's always a chance of breaking changes. I actually wrote a patch to pull this into the core (though without the extra redundant manager/command classes from above), but it hasn't had much attention either.
  5. Offline


    Very nice... I'm using it currently and its usefull for hiding references between the classes ;)
  6. Offline


    I have one question: How do the CommandManager handle with aliases??
Thread Status:
Not open for further replies.

Share This Page