How do I disable PvP on my Minecraft server?
In this article
PvP (player versus player) decides whether players can attack each other. On a friendly survival server, a building server or a server for children you usually want it off; on a server with arenas you want it on only there. PvP is on by default. Since Java 1.21.9 you control it server-wide with the gamerule pvp; on older versions it lived in server.properties. Per region you use a plugin.
Disabling it server-wide with the gamerule (Java 1.21.9 and newer)
- Go to the game panel and click your server.
- Open the Console tab.
- Type
gamerule pvp falseand press Enter. The console confirms: Game rule pvp is now set to false.
This works immediately, without a restart, and stays in place after a restart. Turn it back on with gamerule pvp true; in-game you type the same with a slash in front, as OP. From 1.21.9 onwards (including 1.21.11 and 26.x) the rule is simply called pvp. The line pvp=false in server.properties no longer does anything on these versions. More gamerules are listed in our overview of Minecraft gamerules and commands.
On Java 1.21.8 and older: through server.properties
- Go to the game panel and click your server.
- Open the Properties page, set PVP to no and save the properties. (Prefer the file itself? Then set
pvp=falseinserver.propertiesthrough File Manager.) - Restart the server; this setting is only read at start-up.
To turn it back on, set the line back to pvp=true and restart again.
What changes, and what does not?
- Players can no longer hit each other with weapons, fists or arrows.
- Damage from TNT, fire, lava, falling and drowning still exists, even when another player causes it. Someone can still pour lava over your house; for that you need claims or WorldGuard.
- Splash potions with a negative effect are blocked on vanilla, but some older versions let them through; test it if it matters.
- Mobs still attack players; PvP is only about players among themselves.
PvP only in certain areas
If you want an arena or a PvP zone on an otherwise peaceful server, leave PvP on server-wide (gamerule pvp true, or pvp=true on 1.21.8 and older) and control it per region with WorldGuard: turn PvP off everywhere with /rg flag __global__ pvp deny, and turn it back on in the arena region with /rg flag arena pvp allow. The other way round works too. Claim plugins such as GriefPrevention have a similar setting per claim, and many Lifesteal and SMP plugins bring their own PvP switch, for example a command with which players choose whether they can be attacked.
Toggling PvP per player
On servers where players want to choose for themselves, use a plugin with a toggle (a /pvp command, for instance). Both players then need PvP enabled before they can hit each other. That prevents a new player from being knocked down at spawn right away, without taking fights away from the veterans.
On Bedrock and Geyser servers
On a Bedrock server PvP is a gamerule too: type gamerule pvp false in the console. If you run a Java server with Geyser so Bedrock players can join, the Java setting applies to everyone; nothing extra is needed.
Checking that it works
Log in with two accounts and try to hit each other: the attacker sees a swing but the opponent takes no damage and is not knocked back. On Java 1.21.9 and newer you can query the current state with gamerule pvp (without a value). If the console reports that server.properties could not be read, check that no space or stray character crept into the line.
Want protection that goes further than PvP, for example against griefing and lava? Read our blog article on securing your Minecraft server. Still stuck? Open a ticket.
Launch your server in 60 seconds on our own hardware.