Minecraft Vengance plugin help

Discussion in 'Plugin Development' started by LaserManSam, Apr 17, 2014.

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

    LaserManSam

    So I am trying to make this vengance plugin, but I've got no one to test it for me.
    So what I am trying to do is when somebody kills you/you kill somebody if they type /vengance it will take 1,5 hearts of your health. Have I done it right?

    This is my code (OTHER THEN MY IMPORTS AND PACKAGE NAME)
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
    {
    Player player = (Player) sender;
    Player targetPlayer = player.getKiller();
    if(cmd.getName().equalsIgnoreCase("vengance"))
    {
    player.sendMessage(ChatColor.GREEN + "You have cast" + ChatColor.DARK_GREEN + " Vengance" + ChatColor.GREEN + ".");
    targetPlayer.damage(3);
    targetPlayer.sendMessage(ChatColor.RED + player.getName() + " has cursed you with vengance.");
    if(targetPlayer.isDead())
    {
    player.sendMessage(ChatColor.GREEN + "Your vengance has killed " + ChatColor.RED + targetPlayer.getName() + ChatColor.DARK_RED + ".");
    }
    else if(!targetPlayer.isDead())
    {
    player.sendMessage(ChatColor.GREEN + "Your vengance has cursed your opponment.");
    }
    }
    return true;
    }
    }
     
Thread Status:
Not open for further replies.

Share This Page