Health? (beginner question)

Discussion in 'Plugin Development' started by vbcnxm, Jun 13, 2014.

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

    vbcnxm

    Whenever I try putting in player.setHealth(20);
    it puts a line through it, how can I fix it?
     
  2. Offline

    Zupsub

    Sorry, but I guess nobody understands you. Provide a picture / more related code / more detailed description.
     
  3. Offline

    vbcnxm

    I was practicing making a plugin by making a basic heal plugin, but whenever I use player.setHealth it just puts a line through it; does this mean it wont work?

    here's a sample of the code

    if(commandLabel.equalsIgnoreCase("heal") || commandLabel.equalsIgnoreCase("h")){
    if(args.length == 0){
    player.setHealth(20);
    player.setFireTicks(0);
    }else if(args.length == 1){
    if(player.getServer().getPlayer(args[0]) != null){
    Player targetPlayer = player.getServer().getPlayer(args[0]);
    targetPlayer.setHealth(20);
    targetPlayer.setFireTicks(0);
    player.sendMessage(ChatColor.GREEN + "healed");
    }else{
    player.sendMessage(ChatColor.RED + "Player not online");
    }
    }
    }
     
  4. Offline

    RonaldMcDerp

    vbcnxm
    player.setHealth(20.0)... should work
     
  5. Offline

    unrealdesign

    What that means is it's deprecated.
    To fix this you need to download Bukkit not just CraftBukkit and import it. Then once you've imported it, you need to put the precedence of Bukkit above CraftBukkit. This will solve your deprecation problem.
     
  6. Offline

    vbcnxm

    That worked, thanks! I would love to hear an explanation if you could.
     
  7. Offline

    PatoTheBest

    jthort likes this.
Thread Status:
Not open for further replies.

Share This Page