[SPIGOT-6917] `/trigger` is dysfunctional/useless when the player's active scoreboard is not the main scoreboard Created: 31/Jan/22 Updated: 01/Feb/22 Resolved: 01/Feb/22 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Grant Gryczan | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 2 |
Labels: | None |
Attachments: |
![]() ![]() ![]() ![]() |
Version: | CraftBukkit version 3417-Spigot-862678e-1eeba6a (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT) |
Plugin: | (Any plugin that changes the player's active scoreboard. A minimal reproduction plugin is attached.) |
Guidelines Read: | Yes |
Description |
Background Information & MotivationI'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 IssueWhile `/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
|
Comments |
Comment by Grant Gryczan [ 01/Feb/22 ] |
Here's a proof-like justification that my proposed fix is necessarily safe (using information I only just realized), in case it helps expedite things: (1) The only thing that can enable an objective for a player is `/scoreboard players enable`. `/scoreboard` can only act on the main scoreboard. And of course feel free to let me know if there's some part of this you don't understand or don't agree with. |
Comment by md_5 [ 01/Feb/22 ] |
[5:16 PM] GrantGryczan: (this is mainly directed at md_5 since they're who i was discussing this with, but i dont want to ping them in case they dont like being pinged. also sorry if this is the wrong channel--wasnt sure if it belonged here or in general) considering it seems there is an in-depth discussion to be had about how to address this issue, would it be better to discuss it over discord instead (perhaps in DMs)? i find discussion over discord to be much easier, especially since this discussion might be more on the lengthy side. plus then we (me especially with my edits) wouldnt be sending so many email notifications to all the watchers for each message and of course, there would be no obligation to respond to me immediately if we do discuss it in discord, just as there isnt over jira. it would just be easier due to discord being synchronous, and because it's easier to keep track of full discussion in discord than in jira comments That's correct. /trigger is the vanilla interface intended as a stand-in for custom commands (hence the name--it triggers data pack functionality). There is a different command dedicated to incrementing a score, /scoreboard players add. The effect of incrementing a score is not the end goal of the /trigger command in general; it's just the means by which Mojang chose to accomplish allowing us to detect players entering /trigger. That's the sole purpose of the /trigger command: something non-ops can enter in chat that can be detected in vanilla. Are they broken by this, or are they broken by a plugin manipulating the scoreboard in a way which is impossible in Vanilla? Depends on your perspective. Consider the parallels between this (multi-scoreboard support) and multi-world support. In Vanilla a command such as /gamerule affects all worlds, whereas in Spigot it only affects the player's current world. That's roughly analagous to the situation here. That's true, but there are three important differences between that situation and this one in your analogy: 1. Per-world game rules can be worked around: a data pack can set a game rule in multiple worlds. On the other hand, a data pack cannot work around this issue whatsoever. Normally, there's no way for data packs to detect non-ops entering anything in chat except /trigger. But with this issue, not even /trigger can be detected, leaving us with no means to detect any chat input from non-ops at all. 2. Users can naturally understand and be satisfied with game rules being per-world. In fact, that functionality is often desirable. On the other hand, for this issue, all the user knows is that /trigger spawn, for example, is supposed to teleport them to spawn. If it instead gives an error, the user is not going to naturally understand or be satisfied with that. There's nothing desirable to be gained from it by users, data pack devs, or plugin devs. 3. If this issue were fixed by making /trigger only interact with the main scoreboard, plugins could continue manipulating scoreboards however they want, with no loss of functionality. In fact, not a single thing would need changing in any plugin, because /trigger is not a feature any plugin uses or would have any reason to use. The same is not true of per-world game rules. (pinging you so you automatically join the thread and see new messages in it since you were participating in this discussion, but feel no obligation to reply immediately, or at all if someone else decides to chip in instead) There are probably children out there holding down spacebar to stay warm in the winter! YOUR UPDATE MURDERS CHILDREN. but even if they did, if a data pack (or plugin for that matter) wanted to let players modify their scores using /trigger, they very well could with or without this change, so thats not exactly relevant either way i was only able to report this due to the fact that i got a hold of a plugin developer who was actually interested in helping me figure out the cause. neither i nor any other data pack developer had ever considered bukkit would add entire separate scoreboards from the vanilla one, so that was really interesting to discover and explained a lot. the plugin developer who explained that to me is also the one who made the minimal repro thats attached to the jira issue |
Comment by Grant Gryczan [ 31/Jan/22 ] |
(Moving this discussion to a thread in the SpigotMC Discord server.) |
Comment by md_5 [ 31/Jan/22 ] |
> I'm talking about the functionality seen by the end user, not the internal implementation. You may not have changed the internal implementation, but the functionality seen be the end-user is still indirectly affected by a Bukkit API. Is it? You can equally say that your proposed change: editing a shadow scoreboard the user can't see is a change to the functionality seen by the end-user. > There is no such use case. Plugins don't use `/trigger`–they have no reason to since they can add custom commands. It's only useful for data packs. There are countless tangible use cases where data packs are broken by this, as `/trigger` is a very common command for data packs to use. There are no such use cases for plugins, so I don't know why you would prioritize consistency with plugins' scoreboards here. You're effectively saying that trigger is only ever used as a datapack function caller, rather than incrementing a scoreboard objective. > There are countless tangible use cases where data packs are broken by this Are they broken by this, or are they broken by a plugin manipulating the scoreboard in a way which is impossible in Vanilla? Depends on your perspective. Consider the parallels between this (multi-scoreboard support) and multi-world support. In Vanilla a command such as /gamerule affects all worlds, whereas in Spigot it only affects the player's current world. That's roughly analagous to the situation here. PS: Please stop editing your post, every time you do it an email is sent. |
Comment by Grant Gryczan [ 31/Jan/22 ] |
> The functionality is exactly the same as Vanilla in that /trigger is Vanilla code untouched by Spigot. I'm talking about the functionality seen by the end user, not the internal implementation. Bukkit may not have changed the internal implementation, but the functionality seen by the end user is still indirectly affected by a Bukkit API in a way which breaks vanilla functionality. The same vanilla commands yield a different result in Bukkit than in vanilla, in a way which end users do not expect (and frequently complain to us about). > For a player expecting /trigger to increment their score as displayed on their scoreboard, that behaviour is now broken. Plugins don't use `/trigger`–they have no reason to since they can add custom commands instead. In the real world, there is no such use case where any plugin's functionality would be broken by this fix. But there are countless real-world use cases where data packs are broken by the lack of this fix, as `/trigger` is a very common command for data packs to use. There are no such use cases for plugins, so why prioritize consistency with plugins' scoreboards here? |
Comment by md_5 [ 31/Jan/22 ] |
> The issue here is that this vanilla functionality is not provided as expected: ` The functionality is exactly the same as Vanilla in that /trigger is Vanilla code untouched by Spigot. Vanilla doesn't have per-player scoreboards so your justification there is moot. Playing devil's advocate here, if this change was made /trigger would not increment the scoreboard currently visible to the player. For a player expecting /trigger to increment their score as displayed on their scoreboard, that behaviour is now broken. |
Comment by Grant Gryczan [ 31/Jan/22 ] |
Also, just in case, it may be worth noting that the fix for this presumably should ideally involve no client-side effects. For example, the vanilla command `/execute as @a run trigger test` (which may be inside a data pack function running purely server-side) runs the trigger as all online players, incrementing their `test` score, without necessarily sending a single packet to any client. |
Comment by Grant Gryczan [ 31/Jan/22 ] |
Using the main scoreboard is the functionality that data packs expect from `/trigger`, as it is the functionality provided by vanilla. The issue here is that this vanilla functionality is not provided as expected: `/trigger` sometimes doesn't use the main scoreboard. For this issue not to be the case, `/trigger` must always use the main scoreboard. That's the expected functionality, so that's necessarily the fix. If that expected functionality is not implemented, players with data packs installed will continue to have this issue. And making `/trigger` always use the main scoreboard would certainly do no harm, since plugins never use `/trigger` (they use custom commands instead). It is not useful for `/trigger` to use any scoreboard but the main one. |
Comment by Doc [ 31/Jan/22 ] |
Well the two commands are not touched... and Trigger use the Main Scoreboard for suggestions but not for run...
but not sure if the fix is make /trigger only use the main scoreboard... |