Is it possible to make a sword that bans a player hit by it?

I'm wondering if it is possible to make a sword (or other weapon or tool) that bans the player being hit from the server permanently.

I tried searching it on Google, with a few different phrases, but to no avail. I found nothing. It seems no one else in the history of ever wants to know.

Is there a chain of command blocks I could write, or some mod I could install for my server that would give this functionality?


Solution 1:

No

The /ban comamnd, which would be used to ban people on a server, cannot be used in command blocks or any other means of automatically running commands.

You can, however, use command blocks to emulate the effect of banning a player, see How can I block people from my Minecraft world? for details.