Two different "getHealth()" methods in code

Discussion in 'Plugin Development' started by jts3304, Nov 14, 2013.

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

    jts3304

    So I'm working on a health plugin that allows players to see and change other players' health. I have run into a problem when trying to get a player's health displayed in the chat: there are two getHealth() methods, one has the double argument, the other has the int argument. When I call the method on a line of code such as this:

    player.sendMessage("The player " + player.getName() + "'s health is " + player.getHealth());

    This brings up an error in Eclipse saying:

    The method getHealth() is ambiguous for the type Player

    Is there some other way to put a player's health into a string for the chat? I have tried getHealthScale(), but it just says the player's maximum health.
     
  2. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

  3. Offline

    xTrollxDudex

    jts3304
    Build against Bukkit. Please, there's been countless threads about this...
     
  4. Offline

    clienthax

    you can also cast the player to damagable
     
    fromgate likes this.
  5. Offline

    jts3304

    clienthax
    Thanks, ill try to cast the player object to damageable
     
Thread Status:
Not open for further replies.

Share This Page