Solved Issue with for loop to take arguments of a command and make a string

Discussion in 'Spigot Plugin Development' started by Snailz, Jun 3, 2017.

Thread Status:
Not open for further replies.
  1. Hi guys,

    I'm trying to use a for loop to read the arguments of my command (/rulesconfirm admin add <question> <answer(true/false)>" and turn the arguments for question into a string but not include question. I added some debug statements and it seams like the loop only runs when I only put one argument after add. I attached the code for the method below. If you need to see any of the other code just ask me or look at it on github here(https://github.com/SnailKun/RulesConfirm).

    Thanks!
    ~Snailz

    METHOD: https://hastebin.com/hotoladula.cpp
     
  2. Either you don't know how a for loop works, or you had a brainfart.
    Code (Text):

            for (int x = 2; x == args.length - 1; x++){
    You need to do for (int x = 2; x < args.length; x++) {
     
  3. OMG I FEEL SO STUPID. Thanks. That's probably the biggest brain fart ive ever had.
     
Thread Status:
Not open for further replies.