Adding to Player Health

Discussion in 'Plugin Development' started by connorftw, Mar 25, 2014.

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

    connorftw

    I'm not exactly sure how to add to a player's current health. Help please?

    Never-mind, I'm stupid.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  2. Have you consulted the JavaDocs? I'd look for some mention of setting the health or something similar. Let me know what you find.
     
  3. Offline

    MrInspector

    Code:java
    1. player.setHealth(player.getHealth() + 5);
    2. // 5 is just an example, change it to whatever you want
     
  4. Offline

    connorftw


    MrInspector

    It doesn't let me do that because the getHealth() field is ambiguous in the sense that there are two getHealth's in Player.
     
  5. Offline

    Wolfey

    MrInspector likes this.
  6. Offline

    connorftw

    Its been...
    Either way I solved by casting Damageable to my player.
    Wolfey MrInspector
     
  7. Offline

    MrInspector

    Alright. :)
     
  8. Offline

    Adoma_

    How do you fix it i have the same
     
  9. Offline

    teej107

    Stop using craftbukkit in your build and use Bukkit.
     
  10. Offline

    Adoma_

    ?? Theres only craftbukkit ?!?
     
  11. Offline

    mrCookieSlime

    No. There is Bukkit, CraftBukkit, ScrapBukkit, ChatBukkit,...

    However Bukkit is the API you use to code.
    CraftBukkit is the Server-Software.
    Amd due to the DDMCA, there ia anyway only Bukkit remaining...

    http://dl.bukkit.org/downloads/bukkit/
     
  12. Offline

    Adoma_

    Oh thanks
     
  13. Offline

    ToPoEdiTs

  14. ToPoEdiTs No offence, but TheBCBroz videos cannot be classified as "very good", considering the amount of bad practices those videos teach and the amount of people who have issues stemming from those bad practices.
     
  15. Offline

    ToPoEdiTs

    also xd
     
Thread Status:
Not open for further replies.

Share This Page