How can I have spaces in my commands

Discussion in 'Plugin Development' started by sammyg7241, Mar 30, 2015.

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

    sammyg7241

    Hi, I was wondering if anyone could tell me how to have spaces in my commands. For example /plugin help.

    Thanks!
     
  2. Offline

    mythbusterma

    @sammyg7241

    Read in text from the String array passed to the onCommand method.
     
  3. Offline

    bcohen9685

    if(cmd.getName().equalsIgnoreCase("plugin" + " help"){
    }

    Shouldn't that work? (Notice the space before help)
     
  4. Offline

    nverdier

    @bcohen9685 No. Because the command's name isn't 'plugin help'. It's just 'plugin'. And the String at index 0 of the arguments is 'help'.
     
  5. Offline

    bcohen9685

    Ah I see. My mistake.

    For some reason editing my last post won't work.. So just set the arguments to zero, then create it almost as another command:

    Example:

    if (args[0].equalsIgnoreCase("example") {
    sender.sendMessage("Blabla");[/code]
     
    Last edited: Mar 31, 2015
  6. Offline

    nverdier

    @bcohen9685 Except that's invalid syntax. The
    Code:
    args[].length
     
    Jomens235 and dlange like this.
  7. Offline

    bcohen9685

    *Sigh*, I'll just stop now XD.
     
    Jomens235 likes this.
Thread Status:
Not open for further replies.

Share This Page