Getting all args from 2.

Discussion in 'Spigot Plugin Development' started by avighnash, Jun 11, 2016.

  1. I am making a MODT command, and for that, I need to get all the args from 2 and set the modt as that. How should I do this? I know I should use a for loop.
     
  2. for(int i = 1; i < args.length; i++) { // Do stuff }
     
  3. You mean get all arguments from arg2 and beyond?
    (ignore the shitty naming)
    Code (Text):
    List<String> msgArgs = new ArrayList<String>();
    for(int i = 1; i < args.length; i++) {
        msgArgs.add(args[i]);
    }
    String messageArgs = StringUtils.join(msgArgs, " ");
    The format for this command was
    /g c <msg>

    so I started the loop at 1.
     
    • Like Like x 1