mojira.dev
MC-263954

trigger command can/set add 0

Many times players like to use this command
execute as @a[scores={Trigger=.. -2147483647}] at @s run say 1
execute as @a[scores={Trigger=1..}] at @s run say 1
execute as @a[scores={Trigger=.. -2147483647}] if entity @s run scoreboard player enable @s Trigger
execute as @a[scores={Trigger=1..2147483647}] if entity @s run scoreboard players enable @s Trigger
Not resident
scoreboard player enable @a Trigger
Because it doesn't require conditions, many commands trigger sometimes, and you don't want players to use the Trigger command when they don't need to

And "/trigger add 0" and "/trigger set 0" obviously shouldn't exist, which increases the uncertainty of the command and sometimes allows the player to exploit the instructions with little to no solution to the instructions

It is also recommended to add a command to disable the scoreboard players enable trigger, which is much better than deleting the scoreboard directly

What I expected to happen was...:
Trigger add 0 and trigger set 0 are no longer viable

Comments 12

While /trigger is often used in datapacks to create "custom commands" that can be used by any player, note that its original intended use was simply to let players change their own scores, which explains some of the design decisions behind the command.

While it's frustrating that /trigger set 0 can't be detected by datapacks when creating custom commands, if you look at it from the perspective of letting players change their scores, it makes sense that they should be able to set it back to 0 too. Similarly, /trigger add 0 is possible in the same way that you can use /xp to add 0 experience points.

With that in mind, this bug report seems like a feature request, so I'd recommend posting it at the Feedback site instead.

Triggers can be enabled while they are not 0, so the set makes absolute sense; for map makers using add 0 is the only way to disable the trigger without changing the value, and whether its used can be detected by using execute store on a scoreboard players enable command.
Fixing this quite literally just removes abilities, and there's nothing broken about this.

trigger add 0 isn't the only way to disable triggers without changing their value; scoreboard players add 0 can also have that feature

Just tested in-game to verify, and no, /scoreboard does not disable the trigger; only /trigger does.
Any suggestion to change the behavior here is just that, a suggestion, not a bug.

It is also mentioned in the text
/scoreboard objectives remove trigger
Also a way
/trigger add 0 is not the only solution

2 more comments

Maybe you don't understand me, and I don't know English, and I use translation software to communicate, maybe it's not what I meant
I mean if someone's trigger scoreboard instruction is set to
execute as @a[scores={trigger=1..}] run say 1
execute as @a[scores={trigger=1..}] run scoreboard players reset @s trigger
(This command means to say 1 once when the trigger score is greater than or equal to 1 and reset the scoreboard, I only want each player to run it only once, and no subsequent scoreboard players to enable @a trigger)
execute as @a[scores={trigger=-2147483647..-1}] run say 1
execute as @a[scores={trigger=-2147483647..-1}] run scoreboard players reset @s trigger
(This command says 1 when the trigger score is between -1 and 2147483647, the conditions are the same as above, I only want each player to run only once, and no subsequent scoreboard players are provided to enable @a trigger)

But if the player/trigger adds trigger 0, it is equivalent to disabling trigger for myself, and that is not my goal

Even if you try to correct the error, it will affect others, because when the scoreboard players enable @a trigger, the player's trigger score becomes 0

trigger add 0 is still not the only way to disable triggers without changing the value, and /trigger set can completely replace its function

So isn't a design flaw a bug?

It isn't a bug, and you can absolutely detect the usage of add 0:

execute as @a store success score @s Objective run scoreboard players enable @s Trigger
execute as @a[scores={Objective=1}] run say trigger was executed
execute as @a[scores={Objective=1}] run trigger Trigger add 0
scoreboard players reset @a Objective

This does not change the state of the triggerable objective, yet detects add 0.
What you're requesting is changes in design, you're not reporting a bug (it's not behaving incorrectly, and it's not going against the intended design).

trigger add 0 is an unfixed vulnerability when a chat trigger command needs to be clicked

The only vulnerability is the map maker's creation not accounting for it. It can absolutely be detected and accounted for with the commands I provided below.

Found a solution for the time being Thank you

zChenX

(Unassigned)

Unconfirmed

1.20.1

Retrieved