/stats command doesn't work on players who aren't op
From a command block, I can't execute the stats command on a player who isn't op.
Linked Issues
Created Issue:
/stats command doesn't work on players who aren't op
From a command block, I can't execute the stats command on a player who isn't op.
is duplicated by
Executing a /stats command is wierd in Multiplayer:
On a fill clock I have a command /execute @a ~ ~ ~ /xp 0L @p
I want to store the XP value in a scoreboard using QueryResult.
In singleplayer this works fine:
/stats @a set QueryResult @p currentXP
However, as soon as I join a server, I want to track the XP for every player - I expected the above command to do exactly this.
However, for some reason the @p selector appears to be executed from the command block - I can't really tell which player the command block takes to score the QueryResult in.
/stats entity oleoleMC set QueryResult oleoleMC currentXP
works fine for a single player however.
Edit: Skylinerw found this out:
Digging a bit into this: it appears that it's the player selector itself in the /stats command that's the problem. Non-op'd players aren't able to use player selectors in commands that are available to them, and it seems that functionality leaked over to CommandStats, even though they shouldn't be expected to be hindered like that. Replacing @p with my in-game name allows it to work, but obviously that's a very poor alternative. I've found the bug report you've made (couldn't find any others either) and will mention this there.
Duplicate with MC-72574.
TL;DR:
Expected:
/stats @a set QueryResult @p currentXP
stores the query result of each individual player in his currentXP score
Reality:
/stats @a set QueryResult @p currentXP
stores the query result of every player in the currentXP score of the player closest to the command block
Command used?
I asked about it here:
http://www.minecraftforum.net/forums/minecraft-discussion/redstone-discussion-and/2229293-stats-command-only-works-on-ops
I can confirm, and did discover what the cause of this is. Here's an example stat being assigned:
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:
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:
For this bloc stat command is :
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:
Affected to a block with command:
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.
ok Skylinerw thank you for your explanation.
So, if i understand you well, in multiplayer, it's impossible to AffectedItems stat for more of one item ?
Because when we use command
this stat will give player item's number that a command
will test.
So if i have more of one command:
only one player's score will be affected by these test ?
I will can't affected stat1 for test of clear item1, affected stat2 for test of clear item2, affected stat3 for test item3 .... isn't it ? cause of my citation need to apply CommandStats to players instead of the command block. citation
Or do you think that i will can affected two stats in each command block who test how many items have a player in his inventory ?
Like :
For one command_block with the command:
And the same for each item that i want test ? =>
Item2:
For one command_block with the command:
Item3:
For one command_block with the command:
...
...
...
Confirmed present in 1.8.1 pre1.
Confirmed present in 1.8.1 release.
Confirmed for 1.8.2 pre-5.
Present in 1.8.2 pre-6.
FIX FIX FIX FIX FIX FIX FIX FIX FIX FIX FIX!!
lol.