getHealth()

Discussion in 'Plugin Development' started by mickedplay, Jun 7, 2014.

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

    mickedplay

    Hello bukkit coders,

    I want to save players health in a HashMap before clicking on a sign.

    HashMap<String, Double> playerHealth = new HashMap<String, Double>();
    playerHealth.put(p.getName(), p.getHealth());

    The method getHealth() is ambiguous for the Type Player.

    I used google, but I didn't find a solution.


    Any help for saving playersHealth in a HashMap?
    Thanks!
     
  2. Offline

    Gater12

    mickedplay
    Use bukkit instead of craftbukkit for your dependency.
     
  3. Offline

    mickedplay

  4. Offline

    LCastr0

    You're using craftbukkit in your dependency. Download bukkit: http://dl.bukkit.org/downloads/bukkit/
    Then go to your plugin project on Eclipse/Your IDE, right click, choose Properties, then go to Java Build Path, delete the craftbukkit one, add the bukkit one, and then add craftbukkit again
     
  5. Offline

    mickedplay

    LCastr0 I'll try, but where's the difference between Bukkit & Craftbukkit?
     
  6. Offline

    L33m4n123

    A good post by desht that explains it quite well

     
    mickedplay likes this.
  7. Offline

    AdamQpzm

    mickedplay Sticky thread about this problem: http://forums.bukkit.org/threads/oops-i-didnt-break-your-plugins-ambiguous-gethealth.156975/

    One or two other threads about this problem:
    https://forums.bukkit.org/threads/ambiguous-method-call-help.259542/
    https://forums.bukkit.org/threads/player-gethealth-in-a-event.252147/
    https://forums.bukkit.org/threads/gethealth-help.240372/
    https://forums.bukkit.org/threads/help-please.237838/
    https://forums.bukkit.org/threads/gethealth-is-ambiguous.231921/
    https://forums.bukkit.org/threads/f...-is-ambiguous-for-the-type-entityname.228249/
    https://forums.bukkit.org/threads/gethealth-is-ambiguous.228237/
    https://forums.bukkit.org/threads/gethealth.227353/
    https://forums.bukkit.org/threads/player-getmaxhealth-problem.218817/
    https://forums.bukkit.org/threads/player-get-health-get-how-much-soups-he-had-in-hes-hotbar.218264/
    https://forums.bukkit.org/threads/gethealth-is-ambiguous-for-the-type-player.215698/
    https://forums.bukkit.org/threads/the-method-gethealth-is-ambiguous-for-the-type-player.214760/
    https://forums.bukkit.org/threads/help-with-my-plugin-wont-get-player-health.212361/
    https://forums.bukkit.org/threads/target-gethealth-error.208123/
    https://forums.bukkit.org/threads/getting-player-health.204195/
    https://forums.bukkit.org/threads/gethealth-getmaxhealth.200176/
    https://forums.bukkit.org/threads/two-different-gethealth-methods-in-code.194860/
    https://forums.bukkit.org/threads/p-gethealth-error.193150/
    https://forums.bukkit.org/threads/please-help-player-health.176919/
    https://forums.bukkit.org/threads/ambiguous-gethealth.176704/
    https://forums.bukkit.org/threads/double-hp-player-gethealth.175774/
    https://forums.bukkit.org/threads/gethealth-problem.172985/
    https://forums.bukkit.org/threads/t...s-ambiguous-for-the-type-livingentity.172649/
    https://forums.bukkit.org/threads/checking-health.169234/
    https://forums.bukkit.org/threads/gethealth-and-getmaxhealth-is-ambiguous.168384/
    https://forums.bukkit.org/threads/i-still-dont-understand-this-livingentitys-gethealth.166316/
    https://forums.bukkit.org/threads/gethealth.164234/
    https://forums.bukkit.org/threads/trouble-displaying-health.162284/
    https://forums.bukkit.org/threads/gethealth-not-working.161136/
    https://forums.bukkit.org/threads/cant-use-bukkit-or-craftbukkit.161364/
    https://forums.bukkit.org/threads/player-gethealth-wont-work-for-1-6.160857/
    https://forums.bukkit.org/threads/player-gethealth-1-6-2-problem.159547/
    https://forums.bukkit.org/threads/1-6-ambiguous-gethealth.158924/
    https://forums.bukkit.org/threads/ambiguous-with-double.158182/
    https://forums.bukkit.org/threads/gethealth-is-ambiguous.157851/
    https://forums.bukkit.org/threads/the-method-gethealth-is-ambiguous-for-the-type-player.157668/
    https://forums.bukkit.org/threads/1-6-1-gethealth-ambiguous.157592/
    https://forums.bukkit.org/threads/health-is-ambiguous.157586/
    https://forums.bukkit.org/threads/gethealth-1-6-1-change-help.157315/
    https://forums.bukkit.org/threads/unable-to-get-players-health.157229/

    And those were just the ones I could be bothered to find. Net result, I don't think you really did search, or did so for less than 2 minutes, because I'm not some magical search wizard to be honest.
     
    mickedplay, teej107 and hankered like this.
Thread Status:
Not open for further replies.

Share This Page