How do I prevent players from destroying my house? [duplicate]

I just build a house and want to prevent players from destroying it. Spawn protection won't work cause it is away from spawn.


You could give all players effects, for one. Suppose your name is bob. Try:

/effect give @a[name=!bob] mining_fatigue 1000000 255 true

in a repeating command block.

If they're in Creative, you can use command blocks to tp them away or kill them if they come too close.

/kill @a[name=!bob,distance=..10]

If your house is 10 blocks long and 10 blocks wide, place this in the center of the house and it will kill all players ten blocks from the home.

You can also use that kill command to destroy tnt by using /kill @e[type=tnt,distance=..10], in case players bomb it from above.

Also, use structure blocks to save your build. https://minecraft.gamepedia.com/Structure_Block.

If you're looking for an answer about files in the server's world, I don't have anything since I don't have a server, but that should give you some tips anyway. Does that help?