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.

1 Answer 1


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, 2021 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. Nov 23, 2021 at 10:22
  • I apologize, you are correct. It was I who misread the question. 🤦🏻‍♂️
    – AdamRaichu
    Nov 23, 2021 at 10:25
  • It was quite ambiguous. Nov 23, 2021 at 10:29
  • Perfect, thank you!
    – A. Niese
    Nov 23, 2021 at 22:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .