The scoreboard command is big and complicated. Go look at the wiki article for it first.
So, the first thing you need to do is set up a scoreboard objective for each achievement:
/scoreboard objective add acquireIron achievement.acquireIron
/scoreboard objective add bakeBread achievement.bakeBread
...
See the wiki for each of the achievements in vanilla Minecraft. Note that Overpowered probably isn't available, since it was added in 1.8, and some mods can add other achievements.
You'll also need a a scoreboard objective to tally all the other achievements:
/scoreboard objective add tally dummy Achievments Taken
Now you'll need a clock, probably a fill clock, although not necessarily a 20Hz fill clock. You'll need a clock that can trigger over 30 command blocks.
There's probably a better way to do the next step on a brand new server, but since that's not the case, I won't go into it. The first command that needs to be run on each clock cycle is a reset of everyone's tally score:
scoreboard players set @a tally 0
Next we need to increment the tally score for each achievement taken:
scoreboard players add @a[score_acquireIron_min=1] tally 1
scoreboard players add @a[score_bakeBread_min=1] tally 1
...
That's it for commands that need to be run on a clock. The only important thing is that the tally score gets reset first, and that every achievement score is checked before the tally score gets reset again.
Finally, you need some way to display this to the server. I would suggest the tab list:
/scoreboard objective setdisplay list tally
Disclaimer: I haven't tested this myself, as I'm away from my desktop computer and a Minecraft installation. I'm pretty sure I haven't missed anything obvious, so this should work fine.
The problem is that you can't target someone without a score using a score selector. So the solution, not surprisingly, is to give everyone a score. You don't have to change anyone's score value either; instead, just "increment" everyone's score by 0, in your case, with the following command:
/scoreboard players add @a hasJoined 0
Better yet, throw that command in a command block that is triggered off a 20Hz clock, and you're guaranteed that everyone always has a score.
The way this works is that everyone that already has a score in the hasJoined
objective won't have their score changed, but everyone else will have their hasJoined
score set to 0.
Best Answer
So it turns out you can't necessarily detect fireballs deflected, but you can detect fireballs deflected into ghasts. The vanilla datapack has the 'Return to Sender' JSON advancement file as:
So you could use a hidden advancement which detects that, and so every time a player gets it, add one to a dummy scoreboard and revoke the advancement.
Another possible thing (which I haven't tested) is the possibility of using the player hurt entity trigger for the advancement on the ghast fireball, so then if the player "hurts" (punches) the fireball the advancement is granted, and you use the same scoreboard process as above.
I will edit whether that is possible and if it is, what JSON advancement file I used when I get around to it.