Minecraft – Player quit detection

minecraft-commandsminecraft-java-edition

I am trying to detect when a player has quit the server, I have the scoreboard to detect when a player quits:

/scoreboard objectives add quit minecraft.custom:minecraft.leave_game

However, the rest of my command blocks only activate when the player re-joins the world. I am trying to set the player deaths to 3 when they quit:

scoreboard players set @a[scores={quit=1}] deaths 3

scoreboard players set @a[scores={quit=1}] quit 0

Is there any way to fix this?

Best Answer

I used something similar to add a welcome back message to a server I play on, and unfortunately, once the player leaves the game, their score cannot be incremented until they rejoin.

I tried finding a solution to this by using an ID system and checking for who is not online but marked as online in a dummy objective (using 1 and 0 as online and offline flags) and setting their here score to 0, but because you can't test for the scores of players who are not online without explicitly naming them, the system does not work.

Hopefully someone else can come up with a different solution to your problem, however.