I am building a Minecraft survival games map, in which the battle area is on a floating island. My friends discovered that if they are falling to the ground, they can quickly logout and log back in to escape fall damage and not die, thus cheating.

Is there anyway to detect if a player logs out so I can increment their Death score?

I'm building it vanilla, I'm trying to make a whole map automated with just command blocks and redstone, this is the last thing I need to do now.

  • 1
    Are you doing everything with redstone, or are you also using other server plugins?
    – Enoch
    Commented May 16, 2015 at 12:58
  • It's not really possible (AFAIK) to change the score of someone who is logged out. I assume it would also be fine for this situation to change their score as soon as they log back in? If so, I'll write up an answer for that.
    – SirBenet
    Commented May 16, 2015 at 19:08
  • What exactly happens after they log back in? I assume they are standing in a pit. How do they get out Then? This is relevant because there might be a different/better solution to your problem than detecting a logout.
    – MrLemon
    Commented May 16, 2015 at 19:11
  • @MrLemon Detecting a relog is actually fairly easy IIRC.
    – SirBenet
    Commented May 16, 2015 at 19:13
  • @colorfusion I thought of this as an XY problem. The actual problem is that his current setup can be beat by relogging, which we might fix, rather than patch, when we know the whole deal.
    – MrLemon
    Commented May 16, 2015 at 19:19

2 Answers 2


First, you should set up a scoreboard objective of type stat.leaveGame:

/scoreboard objectives add JustLeft stat.leaveGame

When a player leaves the world, their JustLeft score will increase by 1 because of its type.

On a clock somewhere, you should then have:

/scoreboard players set @a[score_JustLeft_min=1] Death 1

To set the death score of players who have just relogged to 1. Followed by:

/scoreboard players set @a[score_Death_min=1] JustLeft 0

So that their JustLeft score is reset after their Death score is set, preventing them being continually killed.

@a only selects online players, so they should only have their Death score set and then reset when they rejoin the world, even though their JustLeft stat will increase to 1 straight away.


Here's the format for the Update Aquatic (1.13):

Adding Score /scoreboard objectives add JustLeft minecraft.custom:minecraft.leave_game

Clock Command 1 /scoreboard players set @a[scores={JustLeft=1..}] Death 1

Clock Command 2 /scoreboard players set @a[scores={Death=1..}] JustLeft 0

Adding to SirBenet's answer, if at all a player is looking to reset the Deaths score for any reason, simply do this: /scoreboard players set @a[scores={Death=1..}] Death 0

The command format changed dramatically after 1.12, and for the better it seems. Removing things like "/testfor" and "/testforblock" and replacing them with "execute if entity " or "execute if block X Y Z "

TIP: adding elipses (...) after the numeric value tells Minecraft to check all values at or above this one; in this example, the command is checking for anyone with score "Deaths" greater than or equal to 1.


You must log in to answer this question.

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