-1

What is the best way to make a PVP free zone, whether it be using commands or by using settings, for a Minecraft realm.

3

Put them on a team

Scoreboard teams have a friendly fire option, which, when it is set to false, makes it impossible for players on the same team to hurt each other.

First set up the team itself

/scoreboard teams add noPvP
/scoreboard teams option noPvP friendlyfire false

Place two command blocks on a clock (or use repeat/chain command blocks from 1.9) and have them run

/scoreboard teams join noPvP @a[team=!noPvP,x=X,y=Y,z=Z,r=R1]
/scoreboard teams leave noPvP @a[team=noPvP,x=X,y=Y,z=Z,rm=R2]

Replace X, Y, Z with the coordinates in the center of your PvP-free zone. R1 and R2 are the radii of the zone. They are different since you don't want the literal edge-case where a player constantly joins and leaves the team. By making R2 a few blocks larger than R1, the border is a bit more "fuzzy".

Note that players can't be on two teams at the same time, meaning that if you already have teams set up, things are a bit more complicated. You could, however, "remember" the originally assigned team by assigning a scoreboard tag corresponding to the team.

  • 1.13 syntax, /team ... instead of /scorboard teams .... For add/remove commands, /team join noPvP @a[team=!noPvP,x=X,y=Y,z=Z,distance=..R1], /team join noPvP @a[team=!noPvP,x=X,y=Y,z=Z,distance=R2..] – pppery Jul 13 at 18:41
0

This is how you can do this: You simply have a clock (I used a hopper one) connected to a command block with this command /effect @a[r=how far you want them to not be able to attack in the form of a number] weakness 1 255 This will make them too weak to hit any entity including players while in the radius.

  • Last time I checked adventure mode doesn't prevent PVP. And the wiki doesn't say anything either... – angussidney Feb 21 '16 at 6:32
  • Forgot, this will only make players not be able to break blocks. Massive edit. – Jason_ Feb 21 '16 at 7:16
-2

maybe resistance? so you cant kill anyone ? command /effect @p resistance 9999 255 true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.