Solved (target.getHealth() Error?

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

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

    mrsamcraft

    FIX:

    Hello,

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

    Code:java
    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

    Webster56

    What is the displayed error ?
     
  3. Offline

    The_Doctor_123

    It's probably ambiguous. Add the Bukkit jar along with your Craftbukkit jar in the build path.
     
  4. Offline

    mrsamcraft

    Webster56
    ERROR MESSAGE: (Same for both)
    Code:
    The method getHealth() is ambiguous for the type Player



    I have, Still getting this error.
     
  5. Offline

    The_Doctor_123

  6. Offline

    mrsamcraft

    I have? Like this?
    [​IMG]
     
  7. Offline

    The_Doctor_123

  8. Offline

    mrsamcraft

    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