Skip to content
BasaltSoftware
Bedrock 1.26.60

Site colour

Discord
Esc

    ↑↓ moveEnter openEsc close

    Keyboard shortcuts
    Ctrl K
    Search the whole site, from any page
    /
    Jump to the sidebar search, or search the whole site where there isn't one
    Enter
    Open the top search result
    Esc
    Clear the search, or close this panel
    ?
    Show these shortcuts
    Before events

    EffectAddBeforeEvent

    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.

    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;
    });

    read-only

    readonly entity: Entity;
    Types

    read-only

    readonly effectType: string;

    As minecraft:speed.

    duration: number;

    Ticks it lasts, which handlers may change.

    WorldBeforeEvents.effectAdd, EffectAddBeforeEventSignal.subscribe, EffectAddBeforeEventSignal.unsubscribe

    From CancellableEvent: cancel