Commands/infobox
The effect command manages status effects on players and other entities.
- Syntax
- Java Edition
effect give <entity> <effect> [<seconds>] [<amplifier>] [<hideParticles>]
effect clear <entity> [<effect>]
- Bedrock Edition
effect <player: target> clear
(removes all effects)effect <player: target> <effect: Effect> [seconds: int] [amplifier: int] [true|false]
(gives an effect)
- Arguments
- player or entity (BE: player: target)
- Specifies the target(s). Must be a player name or a target selector (
@e
is permitted to target entities other than players).
- Specifies the target(s). Must be a player name or a target selector (
- effect (BE: effect: Effect)
- Specifies the effect to grant. Must be a status effect id (for example,
1
orminecraft:speed
).
- Specifies the effect to grant. Must be a status effect id (for example,
- seconds (BE: seconds: int) (optional)
- Specifies the effect's duration in seconds. Must be between 0 and 1,000,000 (inclusive, without the commas). If not specified, defaults to 30 seconds.
- amplifier (BE: amplifier: int) (optional)
- Specifies the number of additional levels to add to the effect. Must be between 0 and 255 (inclusive). If not specified, defaults to 0. Note that the first tier of a status effect (e.g. Regeneration I) is 0, so the second tier, for example Regeneration II, would be specified by an amplifier level of 1.
- hideParticles (BE: true|false) (optional)
- Specifies whether the particles and the HUD indicator[Java Edition only] of the status effect should be hidden. Must be either
true
orfalse
. If not specified, defaults tofalse
.
- Specifies whether the particles and the HUD indicator[Java Edition only] of the status effect should be hidden. Must be either
- Result
- Fails if arguments are not specified correctly, if player fails to resolve to one or more valid entities (named players must be online), if seconds was specified as 0 and the target did not have the effect, or if no effects were removed in
clear
mode.
- On success:
clear
— clears all status effects from the target(s).
- effect — Adds the status effect to the target(s). If a target already has the status effect, a new status effect with the same amplifier will only override the old duration if it is longer, but a new status effect with a higher duration will override any previous duration. If seconds is set to 0, cancels the specified effect instead.
- Examples
- To grant a Speed II effect to the nearest player for 60 seconds:
effect @p 1 60 1
oreffect give @p speed 60 1
- To grant a Speed III effect to the nearest player for 60 seconds:
effect @p minecraft:speed 60 2
oreffect give @p minecraft:speed 60 2
- To clear any Haste effects from all players:
effect @a minecraft:haste 0
oreffect clear @a minecraft:haste
- To clear all effects from all zombies:
effect @e[type=zombie] clear
oreffect clear @e[type=zombie]