Solved Player's Health is acting up ...

Discussion in 'Plugin Development' started by number1_Master, Mar 27, 2013.

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

    number1_Master

    Edit: Resolved problem. I had a ';' after the if statement!

    So, for my plugin I must increment / decrement the player's health based on the player's height. I managed to do this, BUT the player's health continues to increment / decrement even though it has reached 0 / 20. In response to this, I wrote an if statement.
    Code:java
    1. if(player.getHealth() > 0 && player.getHealth() < 20);

    This did not work, so I increased the minimum and decreased the maximum health.
    Code:java
    1. if(player.getHealth() > 5 && player.getHealth() < 15);

    This also did not work ... so I added some debug messages.
    Code:java
    1. System.out.println(player.getHealth());
    2. if(player.getHealth() > 5 && player.getHealth() < 15);
    3. {
    4. System.out.println("ya");
    5. }

    Even though the player's health is (for example) 3, the code still prints out "ya." I'm a missing something here or is that not supposed to do that? Is it possible the code is being generated too fast because it occurs on PlayerMoveEvent?

    Edit: Resolved problem. I had a ';' after the if statement!
     
  2. Offline

    Nitnelave

    Mark it as solved.
     
  3. Offline

    number1_Master

    Yes, I was going to do that but forgot :p Thanks for reminding me :)
     
Thread Status:
Not open for further replies.

Share This Page