Solved (target.getHealth() Error?

Discussion in 'Plugin Development' started by mrsamcraft, Dec 19, 2013.

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


    So I have yet, hit another brick wall... This time with this error?...

    1. if (target.getHealth() - damage < 0.0D) {
    2. target.setHealth(0.0D);
    3. }
    4. else
    5. {
    6. target.setHealth(target.getHealth() - damage);
    7. }

    How can I fix this?

    Many Thanks,
    ~ Sam
  2. Offline


    What is the displayed error ?
  3. Offline


    It's probably ambiguous. Add the Bukkit jar along with your Craftbukkit jar in the build path.
  4. Webster56
    ERROR MESSAGE: (Same for both)
    The method getHealth() is ambiguous for the type Player

    I have, Still getting this error.
  5. Offline


  6. I have? Like this?
  7. Offline


  8. I've fixed it, getHealth method doesn't work with craftbukkit.jar. I removed that, and imported Bukkit.jar. Instead.

    Thanks for the time and help anyways!
Thread Status:
Not open for further replies.

Share This Page