mojira.dev
MC-259085

scoreboard enable sets the scoreboard value if not set

When a scoreboard is created or reset it has no value but if it is enabled the value is set to 0.
This can lead to unintended behaviour since it is not what I expect.

How to reproduce:

/scoreboard objectives add test trigger
/scoreboard players enable @s test
/scoreboard players get @s test

Returns 0 instead of an error that the value is not set

Linked issues

Comments 2

This seems to be intentional, as the enabled state is saved to the score value object:

{Name:"SCOREHOLDER",Objective:"OBJECTIVE",Score:X,Locked:true/false}

All entries in PlayerScores in scoreboard.dat have all values, even those without a trigger objective have Locked.

Additionally, this is the same behavior as using a non-initialized score in /scoreboard players operation, even the source score gets set to 0 if it isn't set.

Thank you for your report!
We're tracking this issue in MC-107049, so this ticket is being resolved and linked as a duplicate.

If you would like to add a vote and any extra information to the main ticket it would be appreciated.

If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
-- I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.

Sertonix

(Unassigned)

Unconfirmed

(Unassigned)

1.19.3

Retrieved