mojira.dev
MC-120149

Command Block not working correctly with scoreboards

On this page it has an example for giving 5 cookies to a random player. I modified it to give 500 XP to a random player. This part seems to work, but the command "/scoreboard players set @a[score_cookie_min=1] cookie 0" doesn't seem to work right. After more testing it seems that the example will give offline players the XP but it will not set the scoreboard back to 0 for them unless they're online. It also seems to give me the XP twice for some reason when I get chosen.

Basically it seems the command "/scoreboard players set @a randomxp 0" doesn't actually work right. The @r will choose a random player even if offline but the @a doesn't choose offline players. Maybe @r should only choose online players?

[15:34:17] [Server thread/INFO]: [@: Set score of randomxp for player oxXMerlinXxo to 1]
[15:34:17] [Server thread/INFO]: [@] oxXMerlinXxo and oxXMerlinXxo has been given 500 XP.
[15:34:17] [Server thread/INFO]: CommandBlock at -1,908,94,1,124 issued server command: /xp give oxXMerlinXxo 500
[15:34:17] [Server thread/INFO]: CommandBlock at -1,908,94,1,124 issued server command: /xp give oxXMerlinXxo 500
[15:34:17] [Server thread/INFO]: [@: Set score of randomxp for player oxXMerlinXxo to 0]

Comments 1

Use /scoreboard players set * cookie 0 to include offline players as well. This is the only way to match offline players.

Mark Reaves

(Unassigned)

Unconfirmed

Minecraft 1.12.1

Retrieved