I can't get max health from player

Discussion in 'Plugin Development' started by GrimoN, Jul 5, 2015.

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

    GrimoN

    Hello, its my problem:
    http://screenshot.sh/oBD8tDLP0M1PI

    And its code:
    Code:
    @EventHandler
       public void xxx(EntityDamageByEntityEvent e){
         if(e.getDamager() instanceof Player){
           Player p = (Player) e.getDamager();
           int hp = p.getMaxHealth()
         }
       }
    

    And WTF?!
     
  2. Offline

    DoggyCode™

    Why don't you just do "int hp = 20;"? 20 is max health... can you explain a bit more in depth of what you want the plugin to do..
     
  3. Offline

    GrimoN

    Max is 25, but i want to get max hp of player.
     
  4. Offline

    Konato_K

    @DoggyCode™ Health is double


    @GrimoN No, it's 20 for a player unless modified, either use Bukkit to compile or cast to Damageable, there are a lot of threads about this, you could just google it and find an answer.
     
  5. Code:
    ((Damageable) p).getMaxHealth()
     
  6. Offline

    teej107

    Don't depend on Craftbukkit. Use Bukkit
     
  7. Offline

    Zombie_Striker

  8. Offline

    lilian58660

Thread Status:
Not open for further replies.

Share This Page