%player.damage(Player that does the damage, Position where the damage occurred(might be relative to the player), Amount of damage, Damage type(usually something like $DamageType::Sword));
To do things to a damaged player you could package armor::onDamage(%data, %player, %damage), armor::damage(%data, %player, %source, %pos, %damage, %type), player::damage(%player, %source, %pos, %damage, %type), projectileData::damage(%data, %projectile, %collision, %fade, %pos, %normal), and I think there's a shapeBase::damage too.
What do you mean by "properly handle friendly fire"? Detect it and do something after? Package one of the above functions and check if the players are in the same minigame(and that they're in minigames at all) and then if you're using Slayer check if %client.getTeam() matches with the other person. Check if friendly fire is enabled, etc.