From a command block, I can't execute the stats command on a player who isn't op.
Linked issues
Comments 11
I can confirm, and did discover what the cause of this is. Here's an example stat being assigned:
/stats entity @a SuccessCount @p OBJECTIVE
The above assigns SuccessCount with player being "@p", which is the important part. Non-op'd players cannot use player selectors in the commands that are available to them, which appears to be the case when CommandStats are initiated (although it's not apparent at first since the player isn't seen running a command). The above should set the same players' score based on commands run through them via /execute, but if they aren't op'd, it doesn't.
Here's an example of a command working for non-op'd players:
/stats entity @a SuccessCount Skylinerw OBJECTIVE
Replacing the player selector with my actual name does work, and any commands run through me will set the score accordingly. Of course, this is no alternative since you can't insert unknown player names.
I don't know if my problem can help here but i have a bug on multiplayer vanilla with command stats.
I have affect a stat command to a block with command:
/execute @a ~ ~ ~ /testforblock ~ ~-1 ~ minecraft:stone
For this bloc stat command is :
/stats block ~ ~-1 ~ set SuccessCount @a Stonewalk
If i m the once on my server and that i'm walking on stone, my score for objectif Stonewalk is 1.
If there is an other player online, doesn t op, and that i'm not online, and that he is walking on stone, his score is 1.
So it work when there is only one player online, op or not op.
Yet, when we are online together, score is not affected by our position on stone block.
It s the same with this type of stats command who affected a bloc with command:
/testfor @a {SelectedItemSlot:0,Inventory:[{Slot:0b,id:"minecraft:xxx"}]}
And the same problem with a stats command:
/stats block ~ ~-1 ~ set AffectedItems @a Objective
Affected to a block with command:
/clear @a minecraft:xxx 0 0
What do you think about it ? It will be an other bug that i must report ? or the same problem ?
@PneuX: your commands are working as intended. If one player is not standing on stone, then everybody's score is set to 0, which is how you've written your command. If the last player to be executed fails the test, then everybody's score is set to 0, likewise with the last player being successful, then everybody's score is set to 1. So you do not have any unintended issues with your commands, as the logic behind it is sound.
If you need to determine when a player is standing on stone, you can instead use /execute's 'detect' syntax. For AffectedItems with multiple players, you would need to apply CommandStats to players instead of the command block, but that requires the players themselves to be OP'd to use player selectors in their stats, hence this bug report.
Command used?