Skip to main content

Class: WorldBeforeEvents

A set of events that fire before an actual action occurs. In most cases, you can potentially cancel or modify the impending event. Note that in before events any APIs that modify gameplay state will not function and will throw an error. (e.g., dimension.spawnEntity)

Constructors

new WorldBeforeEvents()

private new WorldBeforeEvents(): WorldBeforeEvents

Returns

WorldBeforeEvents

Properties

chatSend

Beta

readonly chatSend: ChatSendBeforeEventSignal

Remarks

This event is triggered after a chat message has been broadcast or sent to players.


effectAdd

readonly effectAdd: EffectAddBeforeEventSignal

Remarks

This event is triggered after an event has been added to an entity.


entityRemove

readonly entityRemove: EntityRemoveBeforeEventSignal

Remarks

Fires before an entity is removed from the world (for example, unloaded or removed after being killed.)


explosion

readonly explosion: ExplosionBeforeEventSignal

Remarks

This event is fired after an explosion occurs.


itemUse

readonly itemUse: ItemUseBeforeEventSignal

Remarks

This event fires when an item is successfully used by a player.


itemUseOn

readonly itemUseOn: ItemUseOnBeforeEventSignal

Remarks

This event fires when an item is used on a block by a player.


playerBreakBlock

readonly playerBreakBlock: PlayerBreakBlockBeforeEventSignal

Remarks

This event fires before a block is broken by a player.


playerGameModeChange

Beta

readonly playerGameModeChange: PlayerGameModeChangeBeforeEventSignal


playerInteractWithBlock

Beta

readonly playerInteractWithBlock: PlayerInteractWithBlockBeforeEventSignal

Remarks

Fires before a player interacts with a block.


playerInteractWithEntity

Beta

readonly playerInteractWithEntity: PlayerInteractWithEntityBeforeEventSignal

Remarks

Fires before a player interacts with an entity.


playerLeave

readonly playerLeave: PlayerLeaveBeforeEventSignal

Remarks

Fires when a player leaves the game.


playerPlaceBlock

Beta

readonly playerPlaceBlock: PlayerPlaceBlockBeforeEventSignal

Remarks

This event fires before a block is placed by a player.


weatherChange

Beta

readonly weatherChange: WeatherChangeBeforeEventSignal


worldInitialize

Beta

readonly worldInitialize: WorldInitializeBeforeEventSignal

Remarks

This event fires immediately when the script environment is initialized on a World. Not all script functionality may be available. For guaranteed access to world state, use the world initialize after event.