.getHealth() help?

Discussion in 'Plugin Development' started by __Sour, Mar 3, 2014.

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

    __Sour

    Hello, i don't know what im doing wrong but I get a red line under .getHealth() says "The method getHealth() is ambiguous for the type Player" anyone know how to fix this it would be great!

    heres my code so far:
    Code:java
    1. @EventHandler
    2. public void onPlayerDeath(PlayerDeathEvent e) {
    3. Player player = e.getEntity();
    4. Player attacker = e.getEntity().getKiller();
    5. e.getDrops().clear();
    6. e.setDroppedExp(3);
    7. if(attacker != null) {
    8. getChat().sendMessage(player, "You have been killed by, §b" + attacker.getDisplayName() + "§r.");
    9. getChat().sendMessage(attacker, "You have killed, §b" + player.getDisplayName() + "§r.");
    10. EconomyResponse p = Kits.econ.depositPlayer(attacker.getName(), 10);
    11. EconomyResponse r = Kits.econ.withdrawPlayer(player.getName(), 5);
    12. if(p.transactionSuccess()) {
    13. getChat().sendMessage(attacker, "Amount received: $10");
    14. } else {
    15. getChat().sendMessage(attacker, "Amount received: $0");
    16. }
    17. if(r.transactionSuccess()) {
    18. getChat().sendMessage(player, "Amount taken: $5");
    19. } else {
    20. getChat().sendMessage(player, "Amount taken: $0");
    21. }
    22. if(attacker.getHealth() != 20.0) {
    23. attacker.setHealth(20.0);
    24. }
    25. }
    26. }
     
  2. Offline

    MooshViolet

  3. Offline

    HungerCraftNL

    PHP:
    ((CraftPlayerplayer).getHandle().getHealth()
    there was something like this too, I'm not sure.
     
  4. Offline

    xTrollxDudex

    __Sour
    Compile with Bukkit not CraftBukkit
     
  5. Offline

    __Sour

  6. Offline

    xTrollxDudex

  7. Offline

    __Sour

Thread Status:
Not open for further replies.

Share This Page