1

Need help with command blocks!

awsm99 12/3/18 10:37 pm
207
12/5/2018 6:26 am
Hello,

My name is FoisyHC and I have been working on my 100% vanilla server. However I cant seem to find anywhere about command blocks that can be used to protect players from mobs,pvp,and griefing at spawn. Please help me!
Posted by
awsm99
Level 1 : New Miner
1

  Have something to say?

JoinSign in

4

Thonck
12/05/2018 6:26 am
Level 21 : Expert System
These are the 1.13 commands. If you want 1.12 commands, just reply and I'll do so!

Kill Commands
/kill @e[type=zombie,distance=..10}]
/kill @e[type=creeper,distance=..10}]
/kill @e[type=skeleton,distance=..10}]
/kill @e[type=enderman,distance=..10}]
/kill @e[type=spider,distance=..10}]
Or just do /kill @e[type=!player,distance=..10}], but this will kill items too

Player Commands
/effect give @a[distance=..10}] minecraft:resistence 1 255 true
1
SUPERIONtheKnight
12/04/2018 12:47 am
Level 30 : Artisan System
There are multiple answers to what you are wanting and they all vary depending on the version you are using.

To prevent mobs from attacking players, you could do any of the following.
  • Set the difficulty to peaceful
  • Kill mobs that you don't want to exist.
  • Completely disable mob spawning.
  • Give players resistance 5 making them almost invulnerable(This also fixes the pvp problem for the most part).
To protect players from pvp, you could do any of the following.
  • Give players weakness(Prevents players from attacking).
  • Give players resistance 5(Also protects players from mobs for the most part).
  • Teleport an entity in front of the player at all times(Probably the worst option unless you want to detect player clicks).
To protect spawn, you could do any of the following.
  • Give the players miner fatigue.
  • Set the players into adventure mode(which is a lot more controllable).
  • Teleport an entity in front of the player at all times(May not be a bad option here, but I haven't ever tested this).
These are just some of the options I thought of, and there could be more. Which options are the best really depends on the following.
  • What exactly are you wanting to do? I know that you want to protect your players, but how?

  • What version are you using? 1.13.2? 1.12? etc... If you are playing on 1.7.10 or below, you may want to look into plugins to do the work for you(1.8 would still be difficult, but possibly manageable with commands(Haven't tested)).

I recommend using the Minecraft Wiki, it has helped me a lot with understanding some of this stuff...

~SUPERIONtheKnight
1
spychicken123
12/04/2018 12:19 am
Level 43 : Master Taco
just make a command block that is repeating underground, then if you are in 1.12.2 then have it set to /effect @a[r=10] minecraft:regeneration 1 99999 that will make it so everyone in a 10 block radius gets regeneration level 99999 but when they leave the area it ends almost right away. change the r= to change the radius or distance around it. in 1.13 i think the command is /effect give @a[r=10] minecraft:regeneration 1 99999 instead
2
SUPERIONtheKnight
12/04/2018 12:58 am
Level 30 : Artisan System
history
This is also a good way to do it, however there is no level 99999. The maximum level that can be used is 255. :)
Also, in 1.13 it's the following /effect give @a[distance=..10] minecraft:regeneration 1 255

~SUPERIONtheKnight
1

Welcome