Solved Loop does not function correctly

Discussion in 'Plugin Development' started by ItsComits, Dec 31, 2017.

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

    ItsComits

    Hello, What I am trying to do is a loop through an enum class values and then do an inner loop that loops from 0-39. But, for some reason the loop does not loop through all of the enum values and that the second loop starts from a random number. By the way. This loop is in onEnable. Any help is greatly appreciated.
    Here is my code:
    Code:
            System.out.print("Values: " + Categorys.values().length); // Length is 5
            for (Categorys mode : Categorys.values()) {
                System.out.print(mode.getName());
                for (int j = 0; j < 39; j++) {
                    System.out.print(Integer.toString(j)); //Should print out 0 - 29 in console
                }
            }
     
  2. Offline

    KingOfTheEast01

    Could you post the Categorys class by any chance? Also, you don't really need to use Integer#toString(), as you integer data types are converted to strings automatically when you print them or add them to a string.
     
  3. Offline

    ItsComits

    @KingOfTheEast01 I found that if I didn't print out the integer then everything would run smoothly. I wonder if it is something to do with the console. (How fast the console can write out?)
     
  4. Offline

    KingOfTheEast01

    The console's speed probably didn't have anything to do with it. I believe it was just having issues processing each integer. Congratulations though. I hope your plugin's development continues to go well. :D
     
Thread Status:
Not open for further replies.

Share This Page