getHealth() problem

Discussion in 'Plugin Development' started by Sweatyyyy, Sep 6, 2013.

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

    Sweatyyyy

    Code:
    Code:java
    1. Player player = (Player) sender;
    2. int health = player.getHealth();
    3. int health1 = Integer.parseInt(args[0]);
    4. health = health - health1;
    5. health1 = health + health1;
    6. player.setHealth(health);
    7. target.setHealth(health1);
    8.  

    On the int health = player.getHealth(); part, I get this error: "The method getHealth() is ambiguous for the type Player"

    How can I fix this? thanks

    Nevermind! :p I saw the sticky note

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  2. Offline

    Atakyn

    getHealth() returns a double
     
  3. Offline

    Retherz_

    Remove craftbukkit, import bukkit then after import craftbukkit.
     
  4. Offline

    Sweatyyyy

    MercilessPvP
    Do you mean remove the external jar?
    And what do you mean by import bukkit? :3
     
  5. Offline

    bennie3211

    Yeah, that's what i want to know too, where can i download that and what is the difference?
     
  6. Offline

    xBlackLightx

  7. Offline

    bennie3211

    may I ask what the difference from bukkit and craftbukkit? :$
     
  8. Offline

    Retherz_

    It works if you import bukkit before craftbukkit
     
  9. Offline

    CubieX

    CraftBukkit is build around the Minecraft server software (NMS -> "native minecraft server").
    So it's an API for the minecraft server.
    And Bukkit is the API for CraftBukkit and is meant to be used by developers primarily for writing plugins.
    Bukkit mainly consists of many interfaces that are getting implemented by CraftBukkit.

    Developers should only access CraftBukkit directly, if there is no public interface available in Bukkit to achieve something.
    Therefore, you should always build against Bukkit and not CraftBukkit, if you don't absolutely need CB or NMS methods. ;)
     
Thread Status:
Not open for further replies.

Share This Page