Multiple Word Commands

Discussion in 'Plugin Development' started by Juicybrains, Feb 6, 2013.

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

    Juicybrains

    Hi there!

    I have a command list that I would like to use, but i can't seam to "register" multiple word commands in the .yml.

    I want a "family" of commands:

    /team create
    /team stats
    /team conquer
    /team abandon
    /team invite

    And I also want other commands, such as:

    /score
    /map
    etc.

    I can't seam to get it to work on the plguin.yml. Can someone help me?
     
  2. Offline

    drtshock

    What does your plugin.yml and your command class look like?
     
  3. Offline

    Taien

    You only define the base commands (like team, score, map) in the plugin.yml. The second, third, etc. words have to be checked in the code that receives the command. You do something like:

    Code:
    if (command.getName().equalsIgnoreCase("team"))
    {
      if (args.length > 0)
      {
          if (args[0].equalsIgnoreCase("create"))
          {
              //stuff
              return true;
          }
          else if (args[0].equalsIgnoreCase("stats"))
          {
              //stuff
              return true;
          }
          else return false;
      }
      else
      {
          //code for when command is issued without arguments
          return true;
      }
    }
     
    StealerSlain and revanevan99 like this.
  4. Offline

    RainoBoy97

    Only register the parent command and not the subcommands in the plugin.yml, so only "teams" and not "teams invite" etc
     
Thread Status:
Not open for further replies.

Share This Page