Plugin Gremlins, and how to command them

Discussion in 'Bukkit News' started by Dinnerbone, Feb 1, 2011.

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

    Dinnerbone Bukkit Team Member

    Gremlins are feisty little creatures. It takes a strong administrator to have the courage to command even the weakest of them. Fortunately, thanks to our new Bustin' Ultimate Kapturator and Kontroller Integrated Trap, we've figured out a way to help tame them and help you shape them to do your bidding for you.

    Any plugin that utilizes onCommand can now take commands from a variety of sources; players in chat, the CLI console, rcon, other plugins, etc. Built in with Craftbukkit, we have chat commands and console commands. Plugins can provide other sources easily, with or without native support for the calling plugin.

    The currently console doesn't look so pretty, so we may look into ways of making that better, such as colours or indentation. However, with Bukkit build 100 and Craftbukkit build 200, you can give them a try and tell us what you think for now!

    We've updated our first default plugin, Scrapbukkit to work with console commands to provide an example on how they work. Plugin developers who're interested in the source, check it out!
  2. Offline


    Excellent stuff :D
    Thanks for all the work you have been putting in guys :).
    Now to update my plugins. xD
  3. Offline


    Thank you for the update!
  4. Offline


    Thats very nice.
    Is it also possible to track where the command is come from?
    Cause you could make debugging commands and only allow it for the Console commands
  5. Offline

    Dinnerbone Bukkit Team Member

    You can cast the CommandSender down to something you recognize.
  6. Offline


    I am confused. What is this saying? The console comes with built-in commands now? Or that developers have more access to certain things?
  7. Offline

    Dinnerbone Bukkit Team Member

    Developers now have access to let you control plugins through the console or through another interface (like rcon, web UI, IRC), the same way you can use commands in game.
  8. Offline


    i think this is very difficult :D
    Does onPlayerCommand still work?
    And do you use onCommand for console commands?
  9. Offline

    Dinnerbone Bukkit Team Member

    You use onCommand for all types of commands. You do not use onPlayerCommand. It's not difficult, you just add a command to your plugin.yml and then do something in onCommand.
  10. Offline


    Now that Craftbukkit can know all available commands, have you plan to auto-generate the print result of the /help command ?

    EDIT: Also, can you set the commands aliases from the plugin.yml ?
  11. Offline


    Why dosen't ''/i'' work on craftbukkit anymore?
  12. Offline


    THANKS Dinnerbone! I was pretty low when I thought I would have to learn the whole command interface from scratch from the docs (not that they are bad, but the trial-error after this study is just too messy).
  13. Offline


    I love this concept- but I'm hoping there is a way to register commands other than via the YML file?

    I want to allow admins to modify the commands used for my plugins- in case they want "/magic" instead of "/cast", or they speak a different language entirely. For this reason (and a few others), I'd like to be able to register them dynamically at runtime.

    Thanks! I really appreciate all the hard work.
  14. Offline


    Is there any documentation for ScrapBukkit? As of now, I have no idea what it does, other than the fact that it's the Bukkit Dev's plugin.
    --- merged: Feb 1, 2011 8:17 PM ---
    Oh hey, I think I found it. This is the link to the .yml, which includes /clear, /give, /tp, /tphere, /time, and /take. I miss anything?
  15. Offline


    foud this inside the .jar in the plugin.yml

    name: ScrapBukkit
    main: com.dinnerbone.bukkit.scrap.ScrapBukkit
    version: 0.1
        description: Clears your inventory
        usage: /<command>
        description: Give you or give out items
        usage: /<command>
        description: Teleports you or someone to somewhere
        usage: |
            Incorrect usage of command /<command>. Examples:
               /<command> Dinnerbone - teleports you to the player named Dinnerbone
               /<command> Bukkit Walrus - teleports a player named Bukkit to a player named Walrus
               /<command> * Monster - telports every online player to a player named Monster
        description: Tp here.
        usage: |
               Incorrect usage of command /<command>. Examples:
               /<command> Dinnerbone - teleports the player named Dinnerbone to you
               /<command> * - teleports every online player to yourself
        description: Sets/shows the current time
        usage: |
               Incorrect usage of command /<command>. Examples:
               /<command> - results in current time (13.00)
               /<command> 13 - sets the time to 13.00
               /<command> day - makes it day
               /<command> night - makes it night
               /<command> raw - results in current raw time
               /<command> =24000 - sets the current raw time (48000 is two days)
               /<command> +1000 - adds raw time (1000 is one hour)
               /<command> -1000 - substracts raw time
        description: Remove an item from your inventory
        usage: Correct usage is /<command> <ItemName | ItemId> [Amount]
  16. Offline


    You got ninja'd. lol Thanks for confirming. I hope to see some more useful commands added to ScrapBukkit soon. If we don't have it all ready, I think a /help menu should be implemented.
  17. Offline


    While onCommand should make our lives easier, it currently adds a ton of work: onCommand was changed so many times that its hart to keep up with fixing the plugins.
    It will be great, once the API isn't changing every day.
  18. Offline


    Oh Dinnerbone - always providing what we need before we need it. Nice work. I appreciate your work as always.
  19. Offline


    hey what im wondering is if this would work with a ssh program such as putty so that i can do commands through that
  20. Offline


    I took a look at the code and answered my own question- for now, no.

    Though it seems like if a getCommandMap() was added to Server and CraftServer, I could call registerCommand() directly- not sure how appropriate that is, though.

    In any case, I'd really love an API for registering and interrogating commands! :)
  21. Offline

    Dinnerbone Bukkit Team Member

    Not very appropriate to register new commands.

    We'd love if you all stick to the yml. It lets us do really cool things later on such as telling you if you're going to come across a command conflict when uploading to fill, or an online repository of commands.
  22. Offline


    Any change of making this all data-driven?

    I know I've been bugging you about this, but it's pretty important to me on a conceptual level.

    I'm really not a fan of all of this really important data buried in hard-coded YML files- I don't like it in Permissions, and I don't really love it creeping so deep into the core API either :(

    Sorry to be a pain, I don't mean to sound harsh- it's just not great for management and administration.

    EDIT: I do understand the need to have info in the YML file for Filler, etc- and it would be cool for Filler to know about console commands, but arguably if the admins could simply modify the command used, conflicts wouldn't be as big of a deal.

    As for a global repository of commands, or some kind of automatically generated help page for each plugin in the repository- that's a very cool idea.

    It certainly would be easier to do this with YML- you don't want to have to fire up the plugins so that they can use an API to register commands just to be able to list them on a web page.

    So, what about if the YML specifies the defaults, but we can modify those at runtime?

    That would let me persist them in my own data store, letting my admins modify them (and their associated help text messages) as they see fit.

    Just throwing out ideas here :)
  23. Offline


    Is onCommand fired via commands defined in the yml case-sensitive? I know I can test the command once I'm in onCommand, but if the command in the yml is lower case, is onCommand only firing when the command is matched exactly/case sensitive (which appeared to be the case when I tested it a week or so ago).
  24. Offline

    Dinnerbone Bukkit Team Member

    I'm aware of the troubles, but it goes both ways. We'll give you access to add aliases to your current commands easily enough (as long as they aren't taken already) but there's just no reason you should want to register a completely new one.
  25. Offline


    That's totally fair! I don't actually want to add new ones at runtime, so much as modify existing ones.

    If I could add or change an alias, and possibly modify the description / help message (via plugin code), I think that would be 100% of what I want, and I would be super appreciative. I'm mainly worried about customization and internationalization here, I know it's early for that, but the sooner the better for that sort of thing IMO.

    It would also be cool to be able to walk through the plugin / command tree via code as well, but I guess I can always parse the YML myself if I really need to :)
    --- merged: Feb 1, 2011 11:40 PM ---
    Sorry if I'm being a nuisance...

    It occurs to me that if there isn't going to be a universal /help command, then I don't really need to be able to do anything but add aliases programmatically, since I'd be implementing my own /help display anyway.

    If there is a /help planned (I imagine there is?), then I don't need to implement my own but I'd love the option of managing the runtime aliases, as well as descriptions (to essentially modify or localize the help text)

    Thanks for your time, and for hearing me out.
  26. Offline

    Dinnerbone Bukkit Team Member

    /help is going to be provided in ChatBukkit, another default plugin. But yes you'll get to edit other properties too.
  27. Offline


    Thanks for the clarification.

    I don't mean to be negative- I really like this system, a lot. In particular, I'm really excited about being able to write a command handler that can accept commands from in-game, as well as server commands, etc. It's a really nice interface.

    If you ever have time to talk about persistence and making things data driven, etc, I would love to discuss.
  28. Offline


    Great, now you can define standards for certain plugin groups so plugins can interact without knowing each other.
  29. Offline


    Nice Stuff!
  30. Offline


    I'm a little confused as to implementing this... From what I understand, onPlayerCommand is now deprecated, and commands have to be declared in plugin.yml? Or can we still use onPlayerCommand if we don't need console?
Thread Status:
Not open for further replies.

Share This Page