Events

Events that fire when a game event happens, like a player joining. Use 'on <event>:' to listen for these in your scripts.

25 events

Block

on block_place
Block
1.0.0

Fires when a player places a block.

Variables
NameTypeNullableDescription
playerPlayerNoThe player who placed the block
blockBlockNoThe block that was placed
itemItemStackNoThe item that was used to place the block
Examples
on block_place:

Entity

on entity_death
Entity
1.0.0

Fires when an entity dies.

Variables
NameTypeNullableDescription
entityEntityNoThe entity that died
killerPlayerYesThe player who killed the entity, or null if not killed by a player
Examples
on entity_death:
on entity_interact
Entity
1.0.0

Fires when a player right-clicks an entity.

Variables
NameTypeNullableDescription
playerPlayerNoThe player who right clicked the entity
entityEntityNoThe entity that was right clicked
itemItemStackYesThe item in the player's main hand, or null if empty
Examples
on entity_interact:
on entity_damage_by_entity
Entity
1.0.0

Fires when an entity takes damage from another entity.

Variables
NameTypeNullableDescription
entityEntityNoThe entity that took damage
damagerEntityNoThe entity that dealt the damage
damagerPlayerPlayerYesThe player who dealt the damage, or null if the damager is not a player
Examples
on entity_damage_by_entity:
on projectile_launch
Entity
1.0.0

Fires when a projectile is launched (arrows, snowballs, eggs, etc.).

Variables
NameTypeNullableDescription
entityEntityNoThe projectile entity that was launched
shooterPlayerYesThe player who launched the projectile, or null if not launched by a player
Examples
on projectile_launch:
on entity_spawn
Entity
1.0.0

Fires when a creature spawns in the world.

Variables
NameTypeNullableDescription
entityEntityNoThe entity that spawned
locationLocationNoThe location where the entity spawned
Examples
on entity_spawn:
on projectile_hit
Entity
1.0.0

Fires when a projectile hits a block or entity.

Variables
NameTypeNullableDescription
entityEntityNoThe projectile entity
shooterPlayerYesThe player who shot the projectile, or null if not shot by a player
hit_entityEntityYesThe entity that was hit, or null if a block was hit
Examples
on projectile_hit:

Inventory

on inventory_drag
Inventory
1.0.0

Fires when a player drags items across slots in an inventory.

Variables
NameTypeNullableDescription
playerPlayerYesThe player who dragged items, or null if the dragger is not a player (unlikely)
inventoryInventoryNoThe top inventory being viewed
nameStringYesThe Lumen inventory name, or null if not a Lumen inventory
Examples
on inventory_drag:
on inventory_open
Inventory
1.0.0

Fires when a player opens an inventory.

Variables
NameTypeNullableDescription
playerPlayerYesThe player who opened the inventory, or null if the viewer is not a player (unlikely)
inventoryInventoryNoThe top inventory that was opened
nameStringYesThe Lumen inventory name, or null if not a Lumen inventory
Examples
on inventory_open:
on inventory_close
Inventory
1.0.0

Fires when a player closes an inventory.

Variables
NameTypeNullableDescription
playerPlayerYesThe player who closed the inventory, or null if the viewer is not a player (unlikely)
inventoryInventoryNoThe top inventory that was closed
nameStringYesThe Lumen inventory name, or null if not a Lumen inventory
Examples
on inventory_close:

Player

on respawn
Player
1.0.0

Fires when a player respawns after dying.

Variables
NameTypeNullableDescription
playerPlayerNoThe player who respawned
respawnLocationLocationNoThe location where the player will respawn
Examples
on respawn:
on move
Player
1.0.0

Fires when a player moves.

Variables
NameTypeNullableDescription
playerPlayerNoThe player who moved
fromLocationNoThe location the player moved from
toLocationNoThe location the player moved to
Examples
on move:
on teleport
Player
1.0.0

Fires when a player teleports.

Variables
NameTypeNullableDescription
playerPlayerNoThe player who teleported
fromLocationNoThe location the player teleported from
toLocationNoThe location the player teleported to
Examples
on teleport:
on interact
Player
1.0.0

Fires when a player interacts with a block or air.

Variables
NameTypeNullableDescription
playerPlayerNoThe player who interacted
actionStringNoThe action type: LEFT_CLICK_BLOCK, RIGHT_CLICK_BLOCK, LEFT_CLICK_AIR, RIGHT_CLICK_AIR, or PHYSICAL (triggering a block by stepping on or colliding with it, such as pressure plates or farmland).
blockBlockYesThe block involved in the interaction, or null if the action targets air
Examples
on interact:
on interact: if action is "LEFT_CLICK_BLOCK": message player "You left clicked a block!"
on interact: if action is "RIGHT_CLICK_BLOCK": message player "You right clicked a block!" else if action is "LEFT_CLICK_AIR": message player "You left clicked in the air!"
on toggle_flight
Player
1.0.0

Fires when a player toggles flight mode.

Variables
NameTypeNullableDescription
playerPlayerNoThe player who toggled flight
flyingbooleanNoWhether the player is now flying
Examples
on toggle_flight: