mojira.dev
MC-96875

/trigger gives a false error when no value for objective is set

Steps to reproduce:

  1. /scoreboard objectives add testTrigger trigger

  2. /trigger testTrigger add 1

    • You get "Invalid trigger name testTrigger" error, although testTrigger already exists. In this case the right message would be "Trigger testTrigger is not enabled"


Code analysis by @unknown can be found in this comment.

Linked issues

Comments 4

WAI
You should first create a trigger objective
/scoreboard objectives add testTrigger trigger
Then enable it for yourself to change
/scoreboard players enable @p testTrigger
Then you can use your command.

Yes, i did, it says that i used Tab Complete to get the trigger name

Confirmed for

  • 16w06a

Could you please change the title to something like "/trigger command gives false error when no value for objective is set"

And please mention in the description a clear way to reproduce. As @unknown pointed out you should mention that you have to create the objective first

Please link to this comment in the description of the report.

The following is based on decompiled version of Minecraft 1.8 using MCP. All method and class names are the names used in the decompiled version.

The reason for this is that when the /trigger command gets executed it is tested whether the player has a score for this trigger objective (using the method public boolean func_178819_b(String p_178819_1_, ScoreObjective p_178819_2_) of the class net.minecraft.scoreboard.Scoreboard). To match with the error message it should be instead tested if the objective exists, using the method public ScoreObjective getObjective(String p_96518_1_) and testing if the returned value is not null.

Edit: That would always create a score entry which might not be the intended behavior.

Alex Tetzlaff

(Unassigned)

Confirmed

Minecraft 16w06a, Minecraft 1.10.2, Minecraft 16w42a, Minecraft 16w43a, Minecraft 16w44a, ..., Minecraft 1.11, Minecraft 16w50a, Minecraft 1.11.1, Minecraft 1.11.2, Minecraft 17w06a

Retrieved