I managed a KitPvP server in Minecraft and everything works fine except when players wants to duel each other. They get sent to a room where they will be dueling. The main problem is when the winner wins, I have no idea how to teleport them back to spawn.

1 Answer 1


Check for the other person not being there. You can do this by tagging an arbitrary player inside the room (would be the only one if he/she won), then checking if there's another untagged one and then removing the tag again:

/tag @p[x=…,y=…,z=…,dx=…,dy=…,dz=…] add inRoom
/execute unless @p[x=…,y=…,z=…,dx=…,dy=…,dz=…,tag=!inRoom] as @p[tag=inRoom] run <command>
/tag @a remove inRoom

Replace "" with the lowest coordinates and the size of the room and "<command>" with whatever you want to do with the winning player (for example teleportation). If you want to do it relative to that player's location, add "at @s" before "run".

  • You would have to set the distance in unless entity @p[distance=.01..<DISTANCE>] to twice the radius of the room (or to the highest possible distance that the players can have within that room), otherwise both players would "win" if they are on opposite sides of the room.
    – user232393
    Aug 17, 2019 at 11:24
  • Oh right, this doesn't work at all. Well, than the longer method: Tag, check for untagged player, untag. Edit: Well, it would still work with one command, but it's messy. Tagging is better. Aug 17, 2019 at 20:49

You must log in to answer this question.

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