Interface in @minecraft/server
Extends CancellableEvent
An effect about to start on a player, from a potion, command or plugin.
import type { EffectAddBeforeEvent } from '@minecraft/server';Subscribe to it with world.beforeEvents.effectAdd.
Example
Section titled “Example”import { world, type EffectAddBeforeEvent } from '@minecraft/server';
world.beforeEvents.effectAdd.subscribe((event: EffectAddBeforeEvent) => { console.log('effectAdd', event.entity.typeId, event.effectType, event.duration);
// Uncomment to stop it from happening. // event.cancel = true;});import { world } from '@minecraft/server';
world.beforeEvents.effectAdd.subscribe((event) => { console.log('effectAdd', event.entity.typeId, event.effectType, event.duration);
// Uncomment to stop it from happening. // event.cancel = true;});Properties
Section titled “Properties”entity
Section titled “entity”read-only
readonly entity: Entity;Types
effectType
Section titled “effectType”read-only
readonly effectType: string;As minecraft:speed.
duration
Section titled “duration”duration: number;Ticks it lasts, which handlers may change.
Used by
Section titled “Used by”WorldBeforeEvents.effectAdd, EffectAddBeforeEventSignal.subscribe, EffectAddBeforeEventSignal.unsubscribe
Inherited
Section titled “Inherited”From CancellableEvent: cancel