[Solved]Creating & Using config strings from command

Discussion in 'Spigot Plugin Development' started by Exus-Kun, May 21, 2015.

Thread Status:
Not open for further replies.
  1. Solved, Code = Confidential.
     
    #1 Exus-Kun, May 21, 2015
    Last edited: May 22, 2015
  2. Does the ./link command work at all?
     
  3. This is your problem. You do this:
    Code (Text):

    String value = args[0];
     
    but then you check if the length of the array is zero. You need to be checking if args.length is 1, not 0. You should also be checking for the array length before assigning a value from it, because you may end up with an ArrayIndexOutOfBoundsException.
     
    • Like Like x 1
  4. Thanks for the help, I'll try it out in a few hours as I'm not near my computer atm
     
  5. No, it doesn't but I'm sure audrey has made it a bit more clearer of what I have done wrong
     
  6. PHP:

            if(cmd.getName().equalsIgnoreCase("link")&& args.length > 0)
            {
                //check your configuration.
            }else
            {
                //Inform player of incorrect arguments.
            }
     
Thread Status:
Not open for further replies.