TogglePvP | Datapack

TogglePvP | Datapack

466 Downloads

This Datapack allows players to toggle PvP on and off using command blocks or commands.

All players who have PvP off will be protected, while all players who have PvP on can attack each other.

Note: A player who has PvP off can stop players who have PvP on from attacking each other, by going near them. I could not find a way to bypass this without making a mod.

Note: Projectiles other than arrows can still hit a player that has PvP off, if shot from a player that has PvP on, and vice-versa.

 If a player has PvP on, he/she will have slight flame particles above him/her.

"pvp" must be set to "true" in the server properties file if you are on a server.

Note: All players will have PvP on by default.

To turn PvP off for a player, use this command:

/execute at (player) run function togglepvp:joinpvpoff

To turn PvP on for a player, use this command:

/execute at (player) run function togglepvp:leavepvpoff

Note: You can turn off the flame particles by using this command (Use this every time the Datapack is (re)loaded to turn it off completely)

/schedule clear togglepvp:particle

You can create a redstone clock with a command block for this if you don't want to use the command every time the Datapack is (re)loaded.

I recommended having a setup like this:

How to Download:

1. Press the Download button in the top right to get the latest version of this Datapack.

2. Find the folder for your world, it should be in User/AppData/Roaming/.minecraft/saves/    (Or wherever you keep your world in your minecraft server folder)

3. Take the TogglePvP folder out of the .zip file.

4. Go into your world folder, and put the TogglePvP folder into the folder that says "datapacks".

5. Now, you're done!!!!

Please leave feedback in the comments :)

One idea I had was making some sort of "PvP charm" that turns PvP on when you have it in your inventory, because it doesn't require the use of commands. I don't know how possible that is though.

Also, please let me know if you want a version that stops all projectiles for players with PvP off.