Solved Can do any command as long as it starts with /eazyhub, how to fix?

Discussion in 'Spigot Plugin Development' started by Orangemaster123, May 26, 2017.

  1. I am quite new to plugin development and I'm trying to develop a hub plugin. I've just noticed and error. The player can type a command as long as it starts with /eazyhub. So they can right something like /eazyhub (bunch of random letters) and it would still do the command.

    Heres the command executor code.
    https://pastebin.com/whViw6c6

    How can I make it so they have to type /eazyhub to do the command.
    Thanks in advance.
     
  2. In your command executor add the following code to the start of your method:
    Code (Text):
    if (args.length > 0) {
        sender.sendMessage("/eazyhub")
        return;
    }
    This checks if there are more than 0 arguments, if so it doesn't run the command.
     
  3. Do you mean args? So you could type /eazyhub arg0 arg1 arg2?
     
  4. Thanks this worked!