I still don't understand this. LivingEntity's getHealth()

Discussion in 'Plugin Development' started by F0G, Aug 8, 2013.

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


    In regards to this topic https://forums.bukkit.org/threads/oops-i-didnt-break-your-plugins-ambiguous-gethealth.156975/ . I don't understand post #7.

    I am having this problem however I still don't understand what I need to do to get a living entity's health. Here is a sample of my code..

    1. @EventHandler
    2. public void entDamage(EntityDamageByEntityEvent event) {
    3. LivingEntity e = (LivingEntity) event.getEntity();
    4. //error: The method getHealth() is ambiguous for the type LivingEntity
    5. Double d = e.getHealth();
    6. e.getServer().broadcastMessage(Double.toString(d));
    7. }

    I will really appreciate it if someone helps.
  2. Offline


    Take a look here.
  3. Offline


    That's Player cast. I'm using LivingEntity, it's different. I still have trouble. I need a way that gives no errors and gets a mob's health.
Thread Status:
Not open for further replies.

Share This Page