HyperScript
Docs

← All of the Docs Commands and events

Events

eventon player join:

A player joins · no

on player join:
    send "&aWelcome, %player.name%!" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%player.world%textWorld the player is in
%player.location%locationWhere the player is standing
x of player's locationnumberThe x of %player.location%, as a number
y of player's locationnumberThe y of %player.location%, as a number: how high it is
z of player's locationnumberThe z of %player.location%, as a number
  • Can be cancelled: No
  • player is: The player who joined

More about on player join:, with a box to try it in

eventon first join:since 1.5.9

Someone joins who has never played here before · no

on first join:
    give 16 bread to player
    broadcast "&6Welcome &e%player.name% &6to the server!"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%player.world%textWorld the player is in
%player.location%locationWhere the player is standing
x of player's locationnumberThe x of %player.location%, as a number
y of player's locationnumberThe y of %player.location%, as a number: how high it is
z of player's locationnumberThe z of %player.location%, as a number
  • Can be cancelled: No
  • player is: The new player

More about on first join:, with a box to try it in

eventon left click:since 1.7.0

A player left-clicks air or a block · yes

on left click:
    if item is "stick":
        send "&7Poke."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe type of item in the player's hand; unset if empty
%event.block%blocktextThe block clicked; unset when clicking air
  • Can be cancelled: Yes
  • player is: The player who clicked

More about on left click:, with a box to try it in

eventon player sneak:since 1.7.0

A player starts sneaking · yes

on player sneak:
    send action bar "&7Sneaking..." to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.location%locationWhere the player is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player sneaking

More about on player sneak:, with a box to try it in

eventon player sprint:since 1.7.0

A player starts sprinting · yes

on player sprint:
    add 1 to {%player%.sprints}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.location%locationWhere the player is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player sprinting

More about on player sprint:, with a box to try it in

eventon player swim:since 1.7.0

A player starts swimming · yes

on player swim:
    apply night vision to player for 30 seconds
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.location%locationWhere the player is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player swimming

More about on player swim:, with a box to try it in

eventon flight toggle:since 1.7.0

A player starts or stops flying · yes

on flight toggle:
    if player does not have permission "fly.use":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.location%locationWhere the player is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player

More about on flight toggle:, with a box to try it in

eventon hand swap:since 1.7.0

A player swaps the items in their hands · yes

on hand swap:
    cancel event
    send "&7Hands are locked here."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: Yes
  • player is: The player

More about on hand swap:, with a box to try it in

eventon slot change:since 1.7.0

A player selects another hotbar slot · yes

on slot change:
    if item is "compass":
        send action bar "&bRight-click to open the menu" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.slot%slotnumberThe hotbar slot now selected, 1 to 9
%event.item%itemtextThe type of item in that slot; unset if empty
  • Can be cancelled: Yes
  • player is: The player

More about on slot change:, with a box to try it in

eventon item break:since 1.7.0

A player's tool or armour breaks · no

on item break:
    send "&cYour %event.item% broke!"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe type of item that broke
  • Can be cancelled: No
  • player is: The player whose item broke

More about on item break:, with a box to try it in

eventon book edit:since 1.7.0

A player writes in or signs a book · yes

on book edit:
    log "%player.name% edited a book"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: Yes
  • player is: The player

More about on book edit:, with a box to try it in

eventon gamemode change:since 1.7.0

A player's game mode is about to change · yes

on gamemode change:
    if event.gamemode is "creative" and player does not have permission "build.creative":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.gamemode%textThe mode being changed to: survival, creative, adventure or spectator
  • Can be cancelled: Yes
  • player is: The player

More about on gamemode change:, with a box to try it in

eventon hunger change:since 1.7.0

A player's hunger bar changes · yes

on hunger change:
    if region at player's location contains "spawn":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.amount%amountnumberThe new hunger level, 0 to 20
  • Can be cancelled: Yes
  • player is: The player

More about on hunger change:, with a box to try it in

eventon player heal:since 1.7.0

A player regains health · yes

on player heal:
    if {%player%.in_combat}:
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.amount%amountnumberHow much health is regained; 2 is one heart
%event.reason%reasontextSATIATED, REGEN, MAGIC, EATING and so on
  • Can be cancelled: Yes
  • player is: The player

More about on player heal:, with a box to try it in

eventon experience gain:since 1.7.0

A player gains experience points · no

on experience gain:
    add amount to {%player%.total_xp}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.amount%amountnumberHow many points were gained
  • Can be cancelled: No
  • player is: The player

More about on experience gain:, with a box to try it in

eventon effect gained:since 1.7.0

A player gets a potion effect · yes

on effect gained:
    if event.effect is "poison" and player has permission "vip.immune":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.effect%textThe effect, e.g. speed or poison
  • Can be cancelled: Yes
  • player is: The player

More about on effect gained:, with a box to try it in

eventon effect ended:since 1.7.0

A potion effect on a player ends · yes

on effect ended:
    send action bar "&7%event.effect% wore off" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.effect%textThe effect that ended
  • Can be cancelled: Yes
  • player is: The player

More about on effect ended:, with a box to try it in

eventon player kick:since 1.7.0

A player is about to be kicked · yes

on player kick:
    log "%player.name% was kicked: %event.reason%"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.reason%reasontextThe reason given
  • Can be cancelled: Yes
  • player is: The player being kicked

More about on player kick:, with a box to try it in

eventon advancement:since 1.7.0

A player completes an advancement · no

on advancement:
    if event.advancement is "story/mine_diamond":
        broadcast "&b%player.name% found diamonds!"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.advancement%textThe advancement's id, e.g. story/mine_diamond
  • Can be cancelled: No
  • player is: The player

More about on advancement:, with a box to try it in

eventon player kill:since 1.7.0

One player kills another; the player is the killer · no

on player kill:
    grant advancement "first kill" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.victim%victimtextThe name of the player who died
%event.location%locationWhere the victim died
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: No
  • player is: The player who made the kill

More about on player kill:, with a box to try it in

eventon projectile shoot:since 1.7.0

A player shoots or throws something · yes

on projectile shoot:
    if entity is "ender_pearl" and {%player%.in_combat}:
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.entity%entitytextWhat was shot, e.g. arrow or snowball
  • Can be cancelled: Yes
  • player is: The player who shot

More about on projectile shoot:, with a box to try it in

eventon projectile hit:since 1.7.0

Something a player shot lands · no

on projectile hit:
    if entity is "snowball" and victim is set:
        send "&bSplat! You hit %event.victim%"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.entity%entitytextWhat was shot, e.g. arrow
%event.victim%victimtextWho or what was hit: a player's name or a mob type; unset for a block
%event.location%locationWhere it landed
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player who shot it

More about on projectile hit:, with a box to try it in

eventon totem use:since 1.7.0

A totem of undying saves a player · yes

on totem use:
    broadcast "&6%player.name% cheated death!"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.location%locationWhere the player is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player who was saved

More about on totem use:, with a box to try it in

eventon block burn:since 1.7.0

Fire destroys a block · yes

on block burn:
    if region at event's location contains "spawn":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.block%blocktextThe block being burnt
%event.location%locationWhere the block is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: Nobody

More about on block burn:, with a box to try it in

eventon explosion:since 1.7.0

Something explodes · yes

on explosion:
    if entity is "creeper":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.entity%entitytextWhat exploded, e.g. creeper or primed_tnt
%event.location%locationWhere it exploded
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: Nobody

More about on explosion:, with a box to try it in

eventon leaves decay:since 1.7.0

Leaves disappear after a tree is cut · yes

on leaves decay:
    if region at event's location contains "park":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.block%blocktextThe kind of leaves
%event.location%locationWhere they are
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: Nobody

More about on leaves decay:, with a box to try it in

eventon redstone:since 1.7.63

The redstone power of a block changes · no

on redstone:
    if event.block is "redstone_lamp":
        if event.power > 0:
            log "A lamp was lit at %event's location%"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.block%blocktextThe block whose power changed
%event.power%numberThe power it has now, 0 to 15
%event.location%locationWhere the block is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: No
  • player is: Nobody

More about on redstone:, with a box to try it in

eventon piston extend:since 1.7.63

A piston pushes out · yes

on piston extend:
    if region at event's location contains "spawn":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.block%blocktextThe piston: piston or sticky_piston
%event.location%locationWhere the piston is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: Nobody

More about on piston extend:, with a box to try it in

eventon piston retract:since 1.7.63

A piston pulls back · yes

on piston retract:
    if region at event's location contains "spawn":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.block%blocktextThe piston: piston or sticky_piston
%event.location%locationWhere the piston is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: Nobody

More about on piston retract:, with a box to try it in

eventon dispense:since 1.7.63

A dispenser or dropper puts out an item · yes

on dispense:
    if event.item is "tnt":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.block%blocktextThe block: dispenser or dropper
%event.item%itemtextWhat it puts out
%event.location%locationWhere the block is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: Nobody

More about on dispense:, with a box to try it in

eventon hopper move:since 1.7.63

A hopper or the like moves an item between containers · yes

on hopper move:
    if event.item is "diamond":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.item%itemtextThe item that is moved
%event.location%locationWhere it is going
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: Nobody

More about on hopper move:, with a box to try it in

eventon crop grow:since 1.7.0

A crop or plant grows a stage · yes

on crop grow:
    if {season} is "winter":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.block%blocktextThe plant, e.g. wheat
%event.location%locationWhere it is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: Nobody

More about on crop grow:, with a box to try it in

eventon bucket fill:since 1.7.0

A player fills a bucket · yes

on bucket fill:
    if region at player's location contains "spawn":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe bucket being used
  • Can be cancelled: Yes
  • player is: The player

More about on bucket fill:, with a box to try it in

eventon bucket empty:since 1.7.0

A player empties a bucket · yes

on bucket empty:
    if item is "lava_bucket" and player does not have permission "build.lava":
        cancel event
        send "&cLava is not allowed."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe bucket being emptied, e.g. lava_bucket
  • Can be cancelled: Yes
  • player is: The player

More about on bucket empty:, with a box to try it in

eventon weather change:since 1.7.0

Rain starts or stops in a world · yes

on weather change:
    if event.weather is "rain":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.weather%textWhat it is changing to: rain or clear
  • Can be cancelled: Yes
  • player is: Nobody

More about on weather change:, with a box to try it in

eventon entity tame:since 1.7.0

A player tames an animal · yes

on entity tame:
    send "&aYou tamed a %event.entity%!"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.entity%entitytextThe animal, e.g. wolf
  • Can be cancelled: Yes
  • player is: The player who tamed it

More about on entity tame:, with a box to try it in

eventon entity breed:since 1.7.0

Two animals have a baby · yes

on entity breed:
    if player is set:
        add 1 to {%player%.animals_bred}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.entity%entitytextThe kind of baby, e.g. cow
  • Can be cancelled: Yes
  • player is: The player who fed them, if a player did

More about on entity breed:, with a box to try it in

eventon shear:since 1.7.0

A player shears a sheep · yes

on shear:
    add 1 to {%player%.sheep_sheared}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.entity%entitytextWhat was sheared, e.g. sheep
  • Can be cancelled: Yes
  • player is: The player

More about on shear:, with a box to try it in

eventon mob target:since 1.7.0

A mob picks a player as its target · yes

on mob target:
    if player is vanished:
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.entity%entitytextThe mob, e.g. zombie
  • Can be cancelled: Yes
  • player is: The player being targeted

More about on mob target:, with a box to try it in

eventon player move:since 1.7.2

A player moves into another block; runs very often, so keep it short · yes

on player move:
    if block at (location below player's location) is "magma_block":
        send action bar "&cHot!" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: Yes
  • player is: The player

More about on player move:, with a box to try it in

eventon portal use:since 1.7.2

A player is about to go through a nether or end portal · yes

on portal use:
    if {%player%.level} < 10:
        cancel event
        send "&cReach level 10 before leaving the overworld."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: Yes
  • player is: The player

More about on portal use:, with a box to try it in

eventon bed leave:since 1.7.2

A player gets out of a bed · no

on bed leave:
    send "&eGood morning, %player.name%!"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: Yes
  • player is: The player

More about on bed leave:, with a box to try it in

eventon item damage:since 1.7.2

An item a player is using loses durability · yes

on item damage:
    if player has permission "tools.unbreaking":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: Yes
  • player is: The player

More about on item damage:, with a box to try it in

eventon harvest:since 1.7.2

A player picks berries or the like from a block without breaking it · yes

on harvest:
    add 1 to {%player%.harvests}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: Yes
  • player is: The player

More about on harvest:, with a box to try it in

eventon glide toggle:since 1.7.2

A player starts or stops gliding with an elytra · yes

on glide toggle:
    if region at player's location contains "spawn":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: Yes
  • player is: The player

More about on glide toggle:, with a box to try it in

eventon entity mount:since 1.7.2

A player gets onto a creature or vehicle · yes

on entity mount:
    send action bar "&7Sneak to get off" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: Yes
  • player is: The player

More about on entity mount:, with a box to try it in

eventon entity dismount:since 1.7.2

A player gets off what they were riding · yes

on entity dismount:
    add 1 to {%player%.rides}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: Yes
  • player is: The player

More about on entity dismount:, with a box to try it in

eventon vehicle enter:since 1.7.0

A player gets into a vehicle · yes

on vehicle enter:
    send action bar "&7Hold on tight" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.entity%entitytextThe vehicle, e.g. boat or minecart
  • Can be cancelled: Yes
  • player is: The player

More about on vehicle enter:, with a box to try it in

eventon vehicle exit:since 1.7.0

A player gets out of a vehicle · yes

on vehicle exit:
    log "%player.name% left a %event.entity%"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.entity%entitytextThe vehicle
  • Can be cancelled: Yes
  • player is: The player

More about on vehicle exit:, with a box to try it in

eventon inventory open:since 1.7.0

A player opens a container · yes

on inventory open:
    if event.inventory is "ender_chest" and {%player%.in_combat}:
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.inventory%textThe kind of container: chest, furnace, anvil and so on
%event.location%locationWhere the container stands; unset for one that stands nowhere, such as an ender chest or a menu a script opened
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player

More about on inventory open:, with a box to try it in

eventon inventory close:since 1.7.0

A player closes a container · no

on inventory close:
    delete {%player%.shop_page}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.inventory%textThe kind of container that was open
  • Can be cancelled: No
  • player is: The player

More about on inventory close:, with a box to try it in

eventon enchant item:since 1.7.0

A player enchants an item at a table · yes

on enchant item:
    add 1 to {%player%.enchants}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe item being enchanted
%event.level%numberHow many levels it costs
  • Can be cancelled: Yes
  • player is: The player

More about on enchant item:, with a box to try it in

eventon furnace smelt:since 1.7.0

A furnace finishes smelting an item · yes

on furnace smelt:
    add 1 to {smelted.%event.item%}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.item%itemtextWhat comes out, e.g. iron_ingot
%event.location%locationWhere the furnace is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: Nobody

More about on furnace smelt:, with a box to try it in

eventon console command:since 1.7.0

A command is run from the console · yes

on console command:
    if command is "stop":
        broadcast "&cThe server is shutting down."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.command%commandtextThe command without the slash, in lower case
%event.message%messagetextThe whole line
  • Can be cancelled: Yes
  • player is: Nobody

More about on console command:, with a box to try it in

eventon shield block:since 1.7.1

A player's raised shield takes a blow completely · no

on shield block:
    add 1 to {%player%.blocks_made}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.attacker%attackertextWho struck: a player's name or a mob type
  • Can be cancelled: No
  • player is: The player holding the shield

More about on shield block:, with a box to try it in

eventon anvil use:since 1.7.1

A player takes the finished item out of an anvil · yes

on anvil use:
    if item is "name_tag" and player does not have permission "anvil.nametags":
        cancel event
        send "&cYou cannot rename name tags here."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe item being taken out
  • Can be cancelled: Yes
  • player is: The player using the anvil

More about on anvil use:, with a box to try it in

eventon villager trade:since 1.7.1

A player takes the goods out of a trade · yes

on villager trade:
    add 1 to {%player%.trades}
    if item is "emerald":
        send action bar "&aA fine deal" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextWhat the player is buying
  • Can be cancelled: Yes
  • player is: The player trading

More about on villager trade:, with a box to try it in

eventon server start:since 1.7.0

Once, when the server has started and every script is loaded; not on a reload · no

on server start:
    log "The server is up. %server.online_players% player(s) online."
Try it
eventon server stop:since 1.7.0

Once, as the server shuts down · no

on server stop:
    set {last_shutdown} to now
Try it
eventon player quit:

A player leaves · no

on player quit:
    hide quit message
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: No
  • player is: The player who left

More about on player quit:, with a box to try it in

eventon player login:since 1.5.7

Someone is connecting, before they are in the game; see Moderation · with refuse login

on player login:
    if {maintenance} and {%player%.staff} is not set:
        refuse login because "&eThe server is being worked on. Back soon!"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.name%textThe name of the player logging in
%event.uuid%textTheir account id
%event.address%textThe address they are connecting from
  • Can be cancelled: With 'refuse login'
  • player is: Nobody yet: 'player' is unset, but {%player%.<name>} is already the variables of whoever is logging in

More about on player login:, with a box to try it in

eventon player death:since 1.5.6

A player dies · Paper only

on player death:
    subtract 5 from {%player%.coins}
    send "&cYou died and lost 5 coins."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.message%messagetextThe death message everyone will see
%event.killer%killertextName of the player who made the kill; unset if none
%event.cause%causetextWhat killed the player: FALL, LAVA, ENTITY_ATTACK and so on
%event.location%locationWhere the player died
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Paper only
  • player is: The player who died

More about on player death:, with a box to try it in

eventon player respawn:since 1.5.6

A player comes back after dying · no

on player respawn:
    make player invulnerable for 5 seconds
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.location%locationWhere the player is about to appear
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: No
  • player is: The player who respawned

More about on player respawn:, with a box to try it in

eventon item pickup:since 1.5.6

A player picks an item up off the ground · yes

on item pickup:
    if item is "diamond":
        add amount to {%player%.diamonds_found}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe type of item, e.g. diamond
%event.amount%amountnumberHow many items are in the stack
%event.location%locationWhere the player is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player picking the item up

More about on item pickup:, with a box to try it in

eventon item drop:since 1.5.6

A player drops an item · yes

on item drop:
    if item is "compass":
        cancel event
        send "&cYou cannot drop your compass."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe type of item, e.g. diamond
%event.amount%amountnumberHow many items are in the stack
%event.location%locationWhere the player is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player dropping the item

More about on item drop:, with a box to try it in

eventon world change:since 1.5.6

A player arrives in another world · no

on world change:
    send "&7You left &f%event.from% &7for &f%player.world%"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%player.world%textWorld the player is in
%event.from%textThe name of the world the player left
%event.location%locationWhere the player is now
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: No
  • player is: The player who changed world

More about on world change:, with a box to try it in

eventon player command:since 1.5.6

A player types any command, before the server runs it · yes

on player command:
    if command is "plugins" and player does not have permission "server.admin":
        cancel event
        send "&cThat command is not available."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.command%commandtextThe command without the slash, in lower case: home
%event.message%messagetextThe whole line as typed: /home set base
%event.location%locationWhere the player is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player who typed the command

More about on player command:, with a box to try it in

eventon block break:

A player breaks a block · yes

enchantment prospector:
    on block break:
        if event.block is "stone":
            if chance of 5%:
                give player 1 gold nugget
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.block%blocktextThe block type, e.g. diamond_ore
%event.location%locationWhere the block is
%event.drops%listThe items the block will drop with the tool in the player's hand
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player breaking the block

More about on block break:, with a box to try it in

eventon block place:since 1.5.8

A player places a block · yes

on block place:
    if block is "tnt" and player does not have permission "build.tnt":
        cancel event
        send "&cTNT is not allowed here."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.block%blocktextThe block type placed, e.g. tnt
%event.location%locationWhere the block was placed
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player who placed it

More about on block place:, with a box to try it in

eventon sign change:since 1.5.8

A player finishes writing on a sign · yes

on sign change:
    if item 1 of event.lines is "[Shop]":
        send "&aShop sign created."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.lines%listThe lines of text, top to bottom
%event.block%blocktextThe kind of sign, e.g. oak_sign
%event.location%locationWhere the sign is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player who wrote the sign

More about on sign change:, with a box to try it in

eventon player teleport:since 1.5.8

A player is about to be teleported · yes

on player teleport:
    if cause is "ENDER_PEARL" and region at event's location contains "spawn":
        cancel event
        send "&cNo pearling into spawn."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.cause%causetextCOMMAND, PLUGIN, ENDER_PEARL, NETHER_PORTAL and so on
%event.location%locationWhere the player is going
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player being teleported

More about on player teleport:, with a box to try it in

eventon entity click:since 1.5.8

A player right-clicks a mob, animal or player · yes

on entity click:
    make event entity glow for player for 10 seconds
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.entity%entitytextThe type clicked, e.g. villager or player
%event.clicked%textA player's name if a player was clicked, otherwise the type
%event.location%locationWhere the clicked entity is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player who clicked

More about on entity click:, with a box to try it in

eventon craft:since 1.5.8

A player takes the result out of a crafting grid · yes

on craft:
    if item is "diamond_sword" and level of player < 10:
        cancel event
        send "&cYou need level 10 to craft that."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe item being crafted, e.g. diamond_sword
%event.amount%amountnumberHow many one craft makes
  • Can be cancelled: Yes
  • player is: The player crafting

More about on craft:, with a box to try it in

eventon consume:since 1.5.8

A player finishes eating or drinking · yes

on consume:
    if item is "golden_apple":
        apply speed 2 to player for 10 seconds
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextWhat was eaten or drunk, e.g. golden_apple
  • Can be cancelled: Yes
  • player is: The player eating or drinking

More about on consume:, with a box to try it in

eventon fish:since 1.5.8

A player reels in a catch · yes

on fish:
    add 1 to {%player%.fish_caught}
    send action bar "&bCatch #%{%player%.fish_caught}%: %event.item%" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextWhat was caught, e.g. cod
%event.amount%amountnumberHow many
  • Can be cancelled: Yes
  • player is: The player fishing

More about on fish:, with a box to try it in

eventon level up:since 1.5.8

A player's experience level goes up · no

on level up:
    play particle effect "level up" at player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.level%numberThe level just reached
%event.old_level%numberThe level before
  • Can be cancelled: No
  • player is: The player who levelled up

More about on level up:, with a box to try it in

eventon bed enter:since 1.5.8

A player gets into a bed · yes

on bed enter:
    set {%player%.bed} to event's location
    send "&7Sleep well."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.location%locationWhere the bed is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player going to bed

More about on bed enter:, with a box to try it in

eventon region enter:since 1.5.8

A player comes into a script region; see Worlds and regions · no

on region enter:
    if event.region is "spawn":
        send title "&aSpawn" with subtitle "&7You are safe here" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.region%textThe name of the region entered
%event.location%locationWhere the player now is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: No
  • player is: The player who entered

More about on region enter:, with a box to try it in

eventon region leave:since 1.5.8

A player leaves a script region · no

on region leave:
    if event.region is "spawn":
        send action bar "&cYou left the safe zone" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.region%textThe name of the region left
%event.location%locationWhere the player now is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: No
  • player is: The player who left

More about on region leave:, with a box to try it in

eventon combat start:since 1.7.50

A player gets into a fight with another player; see Combat and being away · no

on combat start:
    send action bar "&cIn combat" to player while player is in combat
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.opponent%textThe name of the other player; unset when a script started it
  • Can be cancelled: No
  • player is: The player who is now in combat

More about on combat start:, with a box to try it in

eventon combat end:since 1.7.50

The fight is over: nobody hit anybody for combat-time · no

on combat end:
    send "&aYou are out of combat."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: No
  • player is: The player who is out of combat again

More about on combat end:, with a box to try it in

eventon afk:since 1.7.50

A player has done nothing for afk-time · no

on afk:
    broadcast "&7%player.name% is away."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: No
  • player is: The player who is away

More about on afk:, with a box to try it in

eventon afk return:since 1.7.50

A player who was away does something again · no

on afk return:
    broadcast "&7%player.name% is back."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: No
  • player is: The player who is back

More about on afk return:, with a box to try it in

eventon kill streak:since 1.7.52

A player kills another player; %event.streak% is how many in a row · no

on kill streak:
    if event.streak is 5:
        broadcast "&6%player.name% is on a killing spree!"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.streak%numberHow many kills in a row this is: 1 for the first
%event.opponent%textThe name of the player who was killed
  • Can be cancelled: No
  • player is: The player who made the kill

More about on kill streak:, with a box to try it in

eventon blocked word:since 1.7.55

A player writes a word in chat that a script blocked; %event.word% is the word · no

on blocked word:
    add 1 to {%player%.warnings}
    if {%player%.warnings} >= 3:
        mute player for 10 minutes because "language"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.word%textThe blocked word that was found
%event.message%textWhat the player wrote, as they wrote it
  • Can be cancelled: No
  • player is: The player who wrote it

More about on blocked word:, with a box to try it in

eventon brew:since 1.7.55

A brewing stand finishes brewing; there is no player · yes

on brew:
    spawn particle "witch" count 20 at event.location
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.location%locationWhere the brewing stand is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: Nobody

More about on brew:, with a box to try it in

eventon entity death:

Any living entity dies; the player is the killer, if there was one · Paper only

on entity death:
    if event.entity is "wither" and player is set:
        set {_boss} to "the Wither"
        fire event "boss killed" with {_boss}
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.entity%entitytextThe type of entity that died
%event.killer%killertextName of the player who made the kill; unset if none
  • Can be cancelled: Paper only
  • player is: The killer, if a player made the kill; otherwise nobody

More about on entity death:, with a box to try it in

eventon player chat:

A player sends a chat message · yes

on player chat:
    set chat format to "&7%player.name% &8>> &f%event.message%"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.message%messagetextThe text of the message
%event.recipients%listNames of the players who will see it
  • Can be cancelled: Yes
  • player is: The sender

More about on player chat:, with a box to try it in

eventon right click:

A player right-clicks air or a block, with either hand. Not when they are looking at a creature or another player in reach: that is on entity click: · yes

on right click:
    cooldown: 2 seconds
    send "&7Click!"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe type of item in the player's hand; unset if empty
%event.block%blocktextThe block clicked; unset when clicking air
%event.location%locationWhere the clicked block is; unset when clicking air
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player who clicked

More about on right click:, with a box to try it in

eventon right click with <item>:since 1.7.14

The same, but only for a player holding that item in either hand. on left click with <item>: likewise · yes

on right click with compass:
    send "&7You are at &f%player.x%, %player.y%, %player.z%"
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe type of item in the player's hand; unset if empty
%event.block%blocktextThe block clicked; unset when clicking air
%event.location%locationWhere the clicked block is; unset when clicking air
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player who clicked

More about on right click:, with a box to try it in

eventon right click on <block>:since 1.7.68

The same, but only for a click on that kind of block: on right click on gold block:. on left click on <block>: likewise, and with <item> may follow: on right click on gold block with stick: · yes

on right click on gold block:
    send "&6That is solid gold."
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.item%itemtextThe type of item in the player's hand; unset if empty
%event.block%blocktextThe block clicked; unset when clicking air
%event.location%locationWhere the clicked block is; unset when clicking air
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The player who clicked

More about on right click:, with a box to try it in

eventon entity damage: (or on hit:)since 1.5.0

Any entity takes damage · yes

on entity damage:
    show floating text "&c-%event.damage%" at victim
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.attacker%attackertextWho dealt the damage: a player's name or a mob type such as zombie. For an arrow or other projectile this is whoever shot it. Unset for damage with no attacker, such as falling
%event.victim%victimtextWho was hurt: a player's name or a mob type
%event.damage%damagenumberDamage actually taken, after armour and effects; 2 is one heart
%event.cause%causetextWhy: FALL, FIRE, ENTITY_ATTACK, PROJECTILE, DROWNING, VOID and so on
%event.entity%entitytextThe victim's entity type, e.g. player or zombie
%event.location%locationWhere the victim is
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: The victim if a player was hurt; otherwise the attacker if a player dealt the damage; otherwise nobody

More about on entity damage:, with a box to try it in

eventon player jump:since 1.5.0

A player jumps · yes

on player jump:
    if {%player%.frozen} is true:
        cancel event
        send action bar "&cYou cannot jump while frozen!" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%player.world%textWorld the player is in
%player.location%locationWhere the player is standing
%event.location%locationWhere the jump started
x of player's locationnumberThe x of %player.location%, as a number
y of player's locationnumberThe y of %player.location%, as a number: how high it is
z of player's locationnumberThe z of %player.location%, as a number
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes. The player is snapped back to where they were, so a small hop may be visible
  • player is: The jumping player

More about on player jump:, with a box to try it in

eventon mob spawn:since 1.5.0

A living creature spawns · yes

on mob spawn:
    if entity is "phantom" and reason is "NATURAL":
        cancel event
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.entity%entitytextThe type of creature, e.g. zombie
%event.reason%reasontextWhy it spawned: NATURAL, SPAWNER, SPAWNER_EGG, BREEDING, CUSTOM and so on
%event.location%locationWhere it spawns
x of event's locationnumberThe x of %event.location%, as a number
y of event's locationnumberThe y of %event.location%, as a number: how high it is
z of event's locationnumberThe z of %event.location%, as a number
  • Can be cancelled: Yes
  • player is: Nobody

More about on mob spawn:, with a box to try it in

eventon inventory click:since 1.5.0

A player clicks in an inventory window · yes

on inventory click:
    if item is "barrier" and event.click_type is "SHIFT_LEFT":
        cancel event
        send "&cThat item cannot be moved." to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
%event.slot%slotnumberThe slot clicked, counting from 1 at the top left of the window, the same numbering open gui uses. Unset for a click outside the window
%event.item%itemtextThe type of item in that slot; unset if it is empty
%event.click_type%textHow it was clicked: LEFT, RIGHT, SHIFT_LEFT, SHIFT_RIGHT, MIDDLE, DROP and so on
  • Can be cancelled: Yes. The click then moves nothing
  • player is: The player who clicked

More about on inventory click:, with a box to try it in

eventon server ping:since 1.5.2

A client refreshes its server list; see Server list · no

on server ping:
    set motd to random item of ["&6Welcome!", "&bNew: sky islands", "&dVote for rewards"]
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%event.address%textThe IP address of the client asking
%server.motd%textThe MOTD from server.properties
%server.online_players%numberPlayers online right now
%server.max_players%numberThe real player limit
  • Can be cancelled: No
  • player is: Nobody: the client has not logged in, so only its address is known

More about on server ping:, with a box to try it in

eventon resource pack accept:since 1.4.0

A player agrees to download a resource pack · no

on resource pack accept:
    send action bar "&aDownloading server resource pack..." to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: No
  • player is: The player

More about on resource pack accept:, with a box to try it in

eventon resource pack decline:since 1.4.0

A player refuses a resource pack · no

on resource pack decline:
    send "&cSome custom items may look wrong without the pack." to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: No
  • player is: The player

More about on resource pack decline:, with a box to try it in

eventon resource pack successfully loaded:since 1.4.0

A player's game has finished applying the pack · no

on resource pack successfully loaded:
    send "&aResource pack loaded!" to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: No
  • player is: The player

More about on resource pack successfully loaded:, with a box to try it in

eventon resource pack failed:since 1.4.0

The download or the pack itself failed · no

on resource pack failed:
    send "&cThe resource pack failed to load." to player
Try it

What this event gives a script

PlaceholderShort formTypeMeaning
%player%playerplayerThe player the event is about; use it wherever a player is expected
  • Can be cancelled: No
  • player is: The player

More about on resource pack failed:, with a box to try it in

Guide and examples
EventFires whenCan be cancelled
on player join:A player joinsno
on first join:Someone joins who has never played here beforeno
on left click:A player left-clicks air or a blockyes
on player sneak:A player starts sneakingyes
on player sprint:A player starts sprintingyes
on player swim:A player starts swimmingyes
on flight toggle:A player starts or stops flyingyes
on hand swap:A player swaps the items in their handsyes
on slot change:A player selects another hotbar slotyes
on item break:A player's tool or armour breaksno
on book edit:A player writes in or signs a bookyes
on gamemode change:A player's game mode is about to changeyes
on hunger change:A player's hunger bar changesyes
on player heal:A player regains healthyes
on experience gain:A player gains experience pointsno
on effect gained:A player gets a potion effectyes
on effect ended:A potion effect on a player endsyes
on player kick:A player is about to be kickedyes
on advancement:A player completes an advancementno
on player kill:One player kills another; the player is the killerno
on projectile shoot:A player shoots or throws somethingyes
on projectile hit:Something a player shot landsno
on totem use:A totem of undying saves a playeryes
on block burn:Fire destroys a blockyes
on explosion:Something explodesyes
on leaves decay:Leaves disappear after a tree is cutyes
on redstone:The redstone power of a block changesno
on piston extend:A piston pushes outyes
on piston retract:A piston pulls backyes
on dispense:A dispenser or dropper puts out an itemyes
on hopper move:A hopper or the like moves an item between containersyes
on crop grow:A crop or plant grows a stageyes
on bucket fill:A player fills a bucketyes
on bucket empty:A player empties a bucketyes
on weather change:Rain starts or stops in a worldyes
on entity tame:A player tames an animalyes
on entity breed:Two animals have a babyyes
on shear:A player shears a sheepyes
on mob target:A mob picks a player as its targetyes
on player move:A player moves into another block; runs very often, so keep it shortyes
on portal use:A player is about to go through a nether or end portalyes
on bed leave:A player gets out of a bedno
on item damage:An item a player is using loses durabilityyes
on harvest:A player picks berries or the like from a block without breaking ityes
on glide toggle:A player starts or stops gliding with an elytrayes
on entity mount:A player gets onto a creature or vehicleyes
on entity dismount:A player gets off what they were ridingyes
on vehicle enter:A player gets into a vehicleyes
on vehicle exit:A player gets out of a vehicleyes
on inventory open:A player opens a containeryes
on inventory close:A player closes a containerno
on enchant item:A player enchants an item at a tableyes
on furnace smelt:A furnace finishes smelting an itemyes
on console command:A command is run from the consoleyes
on shield block:A player's raised shield takes a blow completelyno
on anvil use:A player takes the finished item out of an anvilyes
on villager trade:A player takes the goods out of a tradeyes
on server start:Once, when the server has started and every script is loaded; not on a reloadno
on server stop:Once, as the server shuts downno
on player quit:A player leavesno
on player login:Someone is connecting, before they are in the game; see Moderationwith refuse login
on player death:A player diesPaper only
on player respawn:A player comes back after dyingno
on item pickup:A player picks an item up off the groundyes
on item drop:A player drops an itemyes
on world change:A player arrives in another worldno
on player command:A player types any command, before the server runs ityes
on block break:A player breaks a blockyes
on block place:A player places a blockyes
on sign change:A player finishes writing on a signyes
on player teleport:A player is about to be teleportedyes
on entity click:A player right-clicks a mob, animal or playeryes
on craft:A player takes the result out of a crafting gridyes
on consume:A player finishes eating or drinkingyes
on fish:A player reels in a catchyes
on level up:A player's experience level goes upno
on bed enter:A player gets into a bedyes
on region enter:A player comes into a script region; see Worlds and regionsno
on region leave:A player leaves a script regionno
on combat start:A player gets into a fight with another player; see Combat and being awayno
on combat end:The fight is over: nobody hit anybody for combat-timeno
on afk:A player has done nothing for afk-timeno
on afk return:A player who was away does something againno
on kill streak:A player kills another player; %event.streak% is how many in a rowno
on blocked word:A player writes a word in chat that a script blocked; %event.word% is the wordno
on brew:A brewing stand finishes brewing; there is no playeryes
on entity death:Any living entity dies; the player is the killer, if there was onePaper only
on player chat:A player sends a chat messageyes
on right click:A player right-clicks air or a block, with either hand. Not when they are looking at a creature or another player in reach: that is on entity click:yes
on right click with <item>:The same, but only for a player holding that item in either hand. on left click with <item>: likewiseyes
on right click on <block>:The same, but only for a click on that kind of block: on right click on gold block:. on left click on <block>: likewise, and with <item> may follow: on right click on gold block with stick:yes
on entity damage: (or on hit:)Any entity takes damageyes
on player jump:A player jumpsyes
on mob spawn:A living creature spawnsyes
on inventory click:A player clicks in an inventory windowyes
on server ping:A client refreshes its server list; see Server listno
on resource pack accept:A player agrees to download a resource packno
on resource pack decline:A player refuses a resource packno
on resource pack successfully loaded:A player's game has finished applying the packno
on resource pack failed:The download or the pack itself failedno

Several scripts (or several blocks in one script) may handle the same event; they run in file-name order. on load: looks like an event but is not one: it runs when the script is loaded, as described under File structure.

Right-clicks. on right click: runs once for each click, whichever hand it was made with and whatever is in it, on a block or in the air. It does not run when the player is looking at a creature or another player that is near enough to click: that click is on entity click:. One case cannot be seen by any plugin: right-clicking the air with a completely empty hand. The game does not tell the server about that click at all. Holding anything, or clicking a block, works.

Events of your own. fire event "<name>" runs every on event "<name>": block, wherever it is, so scripts can tell each other that something happened without knowing about each other:

# In Bosses.hs
on entity death:
    if event.entity is "wither" and player is set:
        set {_boss} to "the Wither"
        fire event "boss killed" with {_boss}

# In Rewards.hs
on event "boss killed":
    add 500 to {%player%.coins}
    broadcast "&6%player.name% &eslew %{_boss}%!"

Inside the block, player is the player of the trigger that fired the event (if it had one), and each local variable handed over with with is there under the same name.

Short names. The word player may be left out of an event's name wherever what is left still means only one event: on join: is on player join:, and likewise on quit:, on chat:, on death:, on respawn:, on command:, on move: and the rest.

Stepping on a block. on step on <block>: is on player move: for players who are standing on that kind of block, which is what a move handler is most often written for:

on step on magma block:
    ignite player for 3 seconds

on step on "slime_block":
    push player upward with force 1.5

Questions. While a script is waiting for an answer to ask or confirm, the player's next chat message is the answer and is not shown to anybody. The answers offered to click on run the command /hsanswer, which any player may use and which does nothing when no question is open.