player.getHealth() 1.6.2 problem

Discussion in 'Plugin Development' started by A5H73Y, Jul 12, 2013.

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

    A5H73Y

    Code:
    @EventHandler
        public void onPlayerDamageEvent(EntityDamageEvent event){
     
            if (!(event.getEntity() instanceof Player)){
                return;
            }
            Player player = (Player)event.getEntity();
            
            if (player.getHealth() <= event.getDamage()) {
    The player.getHealth() errors, but when I look for possible arguments .getHealth() is available but when chosen errors xD

    Can I have some help please?
    Thanks :)
     
  2. Offline

    XDki113r

    To complete what he says cause it's not enough informations, (I have the same problem) when we do player.getHealth() in 1.6.2 with "craftbukkit-1.6.2-R0.1-20130714.003518-7" it says "The method getHealth() is ambiguous for the type Player" because there is actually player.getHealth() that returns an int AND player.getHealth() which returns a double even if the int version is qualified as deplecated.
     
  3. Offline

    felixfritz

    I haven't quiet figured out how it all works, but that's the only solution I've got right now:

    Code:java
    1. ((CraftPlayer) player).getHandle().getHealth();
     
  4. Offline

    smsunarto

    Wrong section, i thing this suppose to be in plugin development

    Requesting the change of this thread category necrodoom
     
    Jimfutsu likes this.
  5. Offline

    Necrodoom

    report the thread, dont tag moderators, please.
    anyway, moved.
     
Thread Status:
Not open for further replies.

Share This Page