Solved What is im doing wrong? for (int x = 1; x <= 3; x++) {

Discussion in 'Plugin Development' started by mactown21, May 15, 2014.

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

    mactown21

    im currently using this in my old plugin

    Code:
              for (int x = 1; x <= 3; x++) {
                Bukkit.broadcastMessage(x);
    And i get a error for .broadcastMessage(x);

     
  2. Offline

    SnipsRevival

    You will need to get a String representation of x. You can do this using Integer.toString(x) I believe.
     
  3. Offline

    mactown21

    Yes that works :) Thanks!
     
  4. Offline

    Europia79

    Or you could try to pass ("" + x) to the method:

    Code:java
    1. for (int x = 1; x <= 3; x++) {
    2. Bukkit.broadcastMessage("" + x);


    Multiple options are always good in my opinion.
     
  5. Offline

    JuicyDev

    I personally prefer String.valueOf(Int) but then again, it's up to personal preference
     
Thread Status:
Not open for further replies.

Share This Page