`/trigger` is dysfunctional/useless when the player's active scoreboard is not the main scoreboard

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • CraftBukkit version 3417-Spigot-862678e-1eeba6a (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT)
    • (Any plugin that changes the player's active scoreboard. A minimal reproduction plugin is attached.)
    • Yes

      Background Information & Motivation

      I'm a data pack developer, and this issue occurs so often for players using our data packs that we've had to make an FAQ for it on our support server. (It's also not trivial to solve since it is tedious to determine which of their many plugins could be triggering the issue, sometimes to the extent that the player just gives up and uninstalls our data packs.)

      `/trigger` is a vanilla command used by data packs to let non-op players interact with the data pack via commands, since there is no way for data packs to add custom commands.

      The way `/trigger` works is, when a scoreboard objective (with the `trigger` criterion) is "enabled" for a player, they can enter `/trigger <objective name>` to increment their score for that objective by 1. Again, this is the only way for data packs to detect any non-op-only command, by detecting an increment in the score.

      A scoreboard objective can be enabled for a player using `/scoreboard players enable <player> <objective name>`. After the player enters `/trigger <objective name>`, it will be disabled again until `/scoreboard players enable` is ran.

      The Issue

      While `/scoreboard` only interacts with the main scoreboard, for whatever reason (perhaps an oversight?), `/trigger`, on the other hand, only interacts with the player's active scoreboard. This causes an issue since data packs are vanilla and can only interact with the vanilla/main scoreboard, making them necessarily incompatible with any plugin that changes the player's active scoreboard away from the main one.

      When the player's active scoreboard is not the main one, they will still see the main scoreboard objectives that are enabled for them in the auto-complete options for `/trigger` just as they would in vanilla:

      But actually entering the command with any of these auto-complete options will give the error message "You cannot trigger this objective yet", which is normally the error message you see when trying to trigger an objective that is not enabled and not in the auto-complete list:

      Ideally, the `/trigger` command should always use the main scoreboard just as `/scoreboard` does. This would be the expected output without this issue (with an objective name of `test`):

      Also may be worth noting this issue occurs in every earlier version I've tested as well, and I've tested as far back as 1.16.

      Minimal Reproduction Steps

      1. Install a plugin that changes the player's active scoreboard, such as https://github.com/MelonCola/ScoreboardTest (JAR file attached).
      2. Start the server and join it.
      3. Make the plugin switch your scoreboard away from the main scoreboard. (For the example plugin I've attached, this can be done by entering `/togglesb`.)
      4. Enter `/scoreboard objectives add test trigger`.
      5. Enter `/scoreboard players enable @a test`.
      6. Enter `/trigger test`. You will see the error "You cannot trigger this objective yet".

            Assignee:
            Unassigned
            Reporter:
            Grant Gryczan
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: