CommandStats entity selectors will only work as long as they don't return multiple entities
How to reproduce:
Spawn two villagers whose scores we want to affect (run this command twice):
/summon Villager ~ ~ ~ {CustomName:Max}
Set up the scoreboard and start tracking the two villagers:
/scoreboard objectives add testObj dummy
/scoreboard objectives setdisplay sidebar testObj
/scoreboard players set @e[name=Max] testObj 10
Spawn a villager which we will use to run commands from and give him appropriate CommandStats tags:
/summon Villager ~ ~ ~ {CustomName:Dave}
/stats entity @e[name=Dave] set AffectedItems @e[name=Max] testObj
Give yourself some stone which Dave can /clear later on:
/give @p stone 64
Let Dave clear your stone:
/execute @e[name=Dave] ~ ~ ~ /clear @p minecraft:stone
Notice how the scoreboard stats for the villagers named Max did not update. Kill one of the villagers named Max so there is only one entity named Max in your world, then give yourself some more stone and run the /execute command again. Notice how the scoreboard stat for the remaining villager Max did update this time.
Created Issue:
AffectedItems selectors will only work as long as they don't return multiple entities
How to reproduce:
Spawn two villagers whose scores we want to affect (run this command twice):
/summon Villager ~ ~ ~ {CustomName:Max}Set up the scoreboard and start tracking the two villagers:
/scoreboard objectives add testObj dummy/scoreboard objectives setdisplay sidebar testObj/scoreboard players set @e[name=Max] testObj 10Spawn a villager which we will use to run commands from and give him appropriate CommandStats tags:
/summon Villager ~ ~ ~ {CustomName:Dave}/stats entity @e[name=Dave] set AffectedItems @e[name=Max] testObjGive yourself some stone which Dave can /clear later on:
/give @p stone 64Let Dave clear your stone:
/execute @e[name=Dave] ~ ~ ~ /clear @p minecraft:stoneNotice how the scoreboard stats for the villagers named Max did not update. Kill one of the villagers named Max so there is only one entity named Max in your world, then give yourself some more stone and run the /execute command again. Notice how the scoreboard stat for the remaining villager Max did update this time.
AffectedItems selectors will only work as long as they don't return multiple entitiesCommandStats selectors will only work as long as they don't return multiple entities
CommandStats entity selectors will only work as long as they don't return multiple entities
is duplicated by
is duplicated by
is duplicated by
with other players joining
That a relevant information you didn't provide in your report in the first place, and that was why I had trouble to reproduce this bug. Anyways, this is a Duplicate of MC-69826
Players are the same entity
I'm not sure what you mean by that, but each players count for 1 entity.
When you execute this command :
/testfor @e[tag=isCheating]
The server will find X matching entity, and since the command block has a AffectedEntities commandstat in it, he will also try to put the score X into the score PCC of the player @a; as defined in :
/stats block x y z set AffectedEntities @a PCC
Since your LAN world has multiple players, the @a selector will return all these players. But as stated in MC-69826 , there must be only one matching entity, so the scores won't be updated. You don't even need to be on an LAN world to reproduce this bug, you just need multiple matching entity in the commandstat selector, e.g : @e[type=ArmorStand,tag=stat]
Sounds like MC-69826.
Not sure if this helps, but under the stats command where it has @e[name=Max], try adding c= (number > 1). I have not used the stats command nor do I know what the actions under the command do, so I'm not sure if the command isn't set up properly or if the issue is WAI.
I will give this a try in a few days, but your comment made me realize the report was titled wrongly (AffectedItems instead of CommandStats) so thanks for that!
Tried, does not work. Thanks for the idea regardless!
Selectors only work if they resolve to a single entity. That's by design and won't be changed. The solution is almost always using /stats on entities.