Getting player health?

Discussion in 'Plugin Development' started by Fedmand, Dec 9, 2013.

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

    Fedmand

    Hey people!

    I'm having difficulties getting a player's health as an "int".
    I've tried getting the health as both an int, double and float but none of those seem to be working.

    When i do this:
    Code:
    int i = (int) player.getHealth();
    It sends me a message saying: "The method getHealth() is ambiguous for the type Player".
    I have no idea what to do about this. Is there really no way to get a player's health?
    I've tried googling the problem and i can't seem to find a solution.

    Do you guys know what to do to get a player's health as either and int, float or double? anything?
    Thanks for helping me out!
     
  2. Offline

    Developing

    Fedmand player.getHealth(); returns a double.
    Simply do this
    Code:java
    1. double hp = player.getHealth();
     
  3. Offline

    Fedmand

    That doesn't work either D: I'm using the latest bukkit development build i that mathers?
     
  4. Offline

    Developing

    Fedmand My bad , im still using 1.6.4 RB. Perhaps you should stay with 1.6.4 RB for the timebeing since the development builds are not stable.
     
  5. Offline

    L33m4n123


    Use bukkit api instead of craftbukkit. Or both if you need craftbukkit
     
  6. Offline

    Fedmand

    Bukkit AAPI? Where do i find that? I usually simply just download the latest version on the dl.bukkit.org page.
    Is that not the right thing to do?
     
  7. Offline

    L33m4n123

  8. Offline

    Fedmand

    @L33m4n123

    This solved the problem. Thank you so much!
     
Thread Status:
Not open for further replies.

Share This Page