In Vanilla Minecraft 1.18, is there a way to give a specific player a status effect if they step within X blocks of an area? I need to give Mining Fatigue on a certain player when they enter my base.

After extensive searching I've looked at the command /effect give

/effect give playerName minecraft:absorption 5 5 true

and also /testfor, but that doesn't seem to work.

The effect should only happen when a certain player is within a certain radius of the command block.


This should work:

/effect give @a[name=playerName,distance=..radius] minecraft:absorption 5 5 true

  • This command will only give the effect to players with that name. You should've used @a[distance=..raidus] instead.
    – AdamRaichu
    Nov 23 '21 at 10:19
  • The question was asking for the selector to target a specific player, not all players within a radius. I may have misunderstood the question, but I think this is a valid answer.
    – MrParrot
    Nov 23 '21 at 10:22
  • I apologize, you are correct. It was I who misread the question. 🤦🏻‍♂️
    – AdamRaichu
    Nov 23 '21 at 10:25
  • It was quite ambiguous.
    – MrParrot
    Nov 23 '21 at 10:29
  • Perfect, thank you!
    – A. Niese
    Nov 23 '21 at 22:52

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.