Head plugin.yml

Discussion in 'Plugin Development' started by DigitalCookie, Apr 14, 2014.

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

    DigitalCookie

    Hello I am creating a head plugin and am getting errors in the plugin.yml. The name version etc is correct and ok but the commands section I think is the problem here is the bottom half of the plugin.yml

    Code:
    commands:
        head:
            usage: /head <playername>
            description: Get a head.
        head help:
            usage: /head help
            description: help on head
     
  2. Offline

    coasterman10

    That is not how you specify commands. If you want a command within a command, such as "/head help", you need to just define "/head", and then check if the first argument is "help" in your onCommand function.
     
  3. Offline

    DigitalCookie

    how would I do this coasterman10 like this?

    head:
    usage: /<command>
    description: core command
    help:
    usage: /head help
    description: help on head
     
  4. Offline

    coasterman10

    DigitalCookie No, it would work more like this:

    plugin.yml:
    Code:
    commands:
      head:
        usage: /head <<playername>|help>
        description: Command for head
    onCommand() in plugin or commandexecutor class:
    Code:java
    1. public boolean onCommand(...) {
    2. if (args.length >= 1) {
    3. if (args[0].equalsIgnoreCase("head")) {
    4. // help command
    5. } else {
    6. // head command
    7. }
    8. }
    9. }
     
Thread Status:
Not open for further replies.

Share This Page