Affects Version/s: Minecraft 1.8.3, Minecraft 1.8.4, Minecraft 1.8.5, Minecraft 1.8.6, Minecraft 15w45a, Minecraft 15w46a, Minecraft 15w49b, Minecraft 15w50a, Minecraft 15w51b, Minecraft 16w03a, Minecraft 16w04a, Minecraft 16w05a, Minecraft 16w05b, Minecraft 16w06a, Minecraft 16w07a, Minecraft 16w07b, Minecraft 1.9 Pre-Release 1, Minecraft 1.9 Pre-Release 2, Minecraft 1.9 Pre-Release 3, Minecraft 1.9 Pre-Release 4, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 2, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.1, Minecraft 1.9.2, Minecraft 1.9.4, Minecraft 16w21a, Minecraft 1.10 Pre-Release 2, Minecraft 1.10, Minecraft 16w35a, Minecraft 16w39c, Minecraft 1.11, Minecraft 1.11.2, Minecraft 17w15a, Minecraft 17w16a, Minecraft 1.12 Pre-Release 2, Minecraft 1.12, Minecraft 1.12.2, Minecraft 17w46a
Fix Version/s: Minecraft 17w47a
Enabling a /trigger for a player who has not yet been enabled before will set their score for the objective to 0, but does not display this on the sidebar scoreboard if the scoreboard is displaying when their trigger is enabled.
- Add scoreboard objective
- Set sidebar display
- Enable trigger
- Notice score does not display on side bar but player has score of 0
- Remove scoreboard display
- Put back display
- Notice score is now displaying as 0 for player
The problem is that the game creates a Score object when enabling a trigger for a player who has no score. As the score value inside the Score object is stored as an int, its default value is 0 (see
MC-107049). Creating a Score object does not send a packet to the player. Changing this would cause the server to send a packet twice is you set a value for a player who had no Score object before, which could cause problems. A solution might be to store the score as an Integer. Then the default value would be null. Some methods would need to be changed then to test if the player has a Score object and the score value is not null instead of testing if the Score object is null.
A problem which should appear already is that using /scoreboard players reset also disables the trigger as it removes the Score object. With the suggested change a parameter like resetScore could be added which only sets the score of the Score object to null and by that remains the trigger state.