What do you call the thing that is in between the square brackets in a Minecraft comand?
Solution 1:
That thing is called target selector argument.
As of Mineraft 1.8.9, there are 20 different arguments available for use:
x, y, z coordinates
r, rm radius (max, min)
m game mode
c count
l, lm experience level (max, min)
score_name max score
score_name_min min score
team team name
name entity name
dx, dy, dz volume dimensions
rx, rxm vertical rotation (max, min)
ry, rym horizontal rotation (max, min)
type entity type
The 1.9 snapshot 15w32b added another argument.
tag scoreboard tag
As you can see, there is no way to check for active effects using target selector arguments. Checking for an entity's active effects can only be done by looking at it's data tag, e.g. checking if it matches {ActiveEffects:[{Id:1b}]}
. The /effect
command is not able to do that by itself, which means that you won't be able to do what you describe in a single command.
Using scoreboards, you can "translate" data tag matching into a score or a tag (1.9 only), which you can then use with target selector arguments.
Create a dummy objective to store the score:
/scoreboard objectives add hasSpeed dummy
Create a 20Hz. clock (setblock/fill clock, in 1.9, use repeat/chain command blocks) and run the following commands:
/scoreboard players set @a hasSpeed 0
/scoreboard players set @a hasSpeed 1 {ActiveEffects:[{Id:1b}]}
Afterwards, you can run
/effect @a[score_hasSpeed=0] 1 1
on the same clock.