player.getMaxHealth() problem

Discussion in 'Plugin Development' started by sohardhun15, Jan 11, 2014.

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

    sohardhun15

    Pls fix this for me! (getHealth() is ambiguous for the type Player )
    Code:java
    1. private void addHeart(Player player) {
    2. double maxHealth = player.getMaxHealth();
    3. if (maxHealth < 30.0) {
    4. double newMaxHealth = maxHealth + 2.0;
    5. player.setMaxHealth(newMaxHealth);
    6. player.setHealth(player.getHealth() + 2.0);
    7. }
    8. }
     
  2. Offline

    felixfritz

    Use Bukkit when working on your plugins, not CraftBukkit.
     
  3. Offline

    sohardhun15

    I got more errors.
     
  4. Offline

    felixfritz

    sohardhun15
    You get more errors when coding with Bukkit instead of CraftBukkit? Or the same error?
     
  5. Offline

    Compressions

    sohardhun15 The only reason you'd get more errors is if you're accessing NMS code. Have both dependencies, but set the Bukkit dependency to a higher priority.
     
  6. Offline

    Sgt_Tailor

    this is a sticky thread on this forum... (link)
     
    evilmidget38 likes this.
Thread Status:
Not open for further replies.

Share This Page