Commands/effect

From Minecraft Wiki
Jump to: navigation, search
effect
Restrictions

Operator

First introduced

Java Edition 1.5 (13w09b)
PE 1.0.5 (Pocket Edition alpha 1.0.5.0)

Add or remove status effects on players and other entities.

Syntax[edit]

  • Java Edition
effect clear [<targets>] [<effect>] (removes an effect)
effect give <targets> <effect> [<seconds>] [<amplifier>] [<hideParticles>] (gives an effect)
  • Bedrock Edition
effect <player: target> clear (removes all effects)
effect <player: target> <effect: Effect> [seconds: int] [amplifier: int] [hideParticles: Boolean] (gives or removes an effect)

Arguments[edit]

<targets> (BE: player: target)

Specifies the target(s). Must be a player name, a target selector or a UUID[Java Edition only]
Permits entities other than players.

<effect> (BE: effect: Effect)

Specifies the effect to add or remove. Must be a status effect id.

<seconds> (BE: seconds: int)

Specifies the effect's duration in seconds. Must be between 1 and 1,000,000‌[Java Edition only], or 1 and 100,000‌[Bedrock Edition only]. (inclusive, without the commas). If not specified, defaults to 30 seconds.

<amplifier> (BE: amplifier: int)

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: hideParticles: Boolean)

Specifies whether the particles and the HUD indicator‌[Java Edition only] of the status effect should be hidden. Must be either true or false. If not specified, defaults to false.

Result[edit]

Fails if arguments are not specified correctly, if <targets> 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 in Bedrock Edition, or if no effects were removed in clear mode.

On success:

  • clear mode — clears status effects from the target(s).
  • effect give (BE: effect) mode — Adds the status effect to the target(s). If a target already has the status effect, a new status effect with the same amplifier overrides the old duration only if it is longer, but a new status effect with a higher duration overrides any previous duration. In Bedrock Edition, if seconds is set to 0, cancels the specified effect instead.

Examples[edit]

  • To grant a Speed II effect to the nearest player for 60 seconds: effect give @p minecraft:speed 60 1[Java Edition only] or effect @p speed 60 1[Bedrock Edition only]
  • To grant a Speed III effect to the nearest player for 60 seconds: effect give @p minecraft:speed 60 2[Java Edition only] or effect @p speed 60 2[Bedrock Edition only]
  • To clear any Haste effects from all players: effect clear @a minecraft:haste[Java Edition only] or effect @a haste 0[Bedrock Edition only]
  • To clear all effects from all zombies: effect clear @e[type=zombie][Java Edition only] or effect @e[type=zombie] clear[Bedrock Edition only]

History[edit]

Java Edition
1.513w09bAdded /effect.
1.6.1preAdded clear argument to /effect.
1.814w06aAdded hideParticles argument to /effect
Pocket Edition
1.0.5alpha 1.0.5.0Added /effect.
alpha 1.0.5.3The amplifier on /effect can no longer have negative values.