event on player join:example
A player joins · no
on player join:
send "&aWelcome, %player.name%!" to playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%player.world%text World the player is in
%player.location%location Where the player is standing
x of player's locationnumber The x of %player.location%, as a number
y of player's locationnumber The y of %player.location%, as a number: how high it is
z of player's locationnumber The 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
event on first join:since 1.5.9 example
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!"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%player.world%text World the player is in
%player.location%location Where the player is standing
x of player's locationnumber The x of %player.location%, as a number
y of player's locationnumber The y of %player.location%, as a number: how high it is
z of player's locationnumber The 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
event on left click:since 1.7.0 example
A player left-clicks air or a block · yes
on left click:
if item is "stick":
send "&7Poke."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The type of item in the player's hand; unset if empty
%event.block%blocktext The 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
event on player sneak:since 1.7.0 example
A player starts sneaking · yes
on player sneak:
send action bar "&7Sneaking..." to playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.location%location Where the player is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on player sprint:since 1.7.0 example
A player starts sprinting · yes
on player sprint:
add 1 to {%player%.sprints}Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.location%location Where the player is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on player swim:since 1.7.0 example
A player starts swimming · yes
on player swim:
apply night vision to player for 30 secondsCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.location%location Where the player is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on flight toggle:since 1.7.0 example
A player starts or stops flying · yes
on flight toggle:
if player does not have permission "fly.use":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.location%location Where the player is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on hand swap:since 1.7.0 example
A player swaps the items in their hands · yes
on hand swap:
cancel event
send "&7Hands are locked here."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The 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
event on slot change:since 1.7.0 example
A player selects another hotbar slot · yes
on slot change:
if item is "compass":
send action bar "&bRight-click to open the menu" to playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.slot%slotnumber The hotbar slot now selected, 1 to 9
%event.item%itemtext The 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
event on item break:since 1.7.0 example
A player's tool or armour breaks · no
on item break:
send "&cYour %event.item% broke!"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The 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
event on book edit:since 1.7.0 example
A player writes in or signs a book · yes
on book edit:
log "%player.name% edited a book"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The 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
event on gamemode change:since 1.7.0 example
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 eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.gamemode%text The 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
event on hunger change:since 1.7.0 example
A player's hunger bar changes · yes
on hunger change:
if region at player's location contains "spawn":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.amount%amountnumber The 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
event on player heal:since 1.7.0 example
A player regains health · yes
on player heal:
if {%player%.in_combat}:
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.amount%amountnumber How much health is regained; 2 is one heart
%event.reason%reasontext SATIATED, 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
event on experience gain:since 1.7.0 example
A player gains experience points · no
on experience gain:
add amount to {%player%.total_xp}Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.amount%amountnumber How many points were gained
Can be cancelled: No
player is: The player
More about on experience gain:, with a box to try it in
event on effect gained:since 1.7.0 example
A player gets a potion effect · yes
on effect gained:
if event.effect is "poison" and player has permission "vip.immune":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.effect%text The 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
event on effect ended:since 1.7.0 example
A potion effect on a player ends · yes
on effect ended:
send action bar "&7%event.effect% wore off" to playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.effect%text The effect that ended
Can be cancelled: Yes
player is: The player
More about on effect ended:, with a box to try it in
event on player kick:since 1.7.0 example
A player is about to be kicked · yes
on player kick:
log "%player.name% was kicked: %event.reason%"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.reason%reasontext The reason given
Can be cancelled: Yes
player is: The player being kicked
More about on player kick:, with a box to try it in
event on advancement:since 1.7.0 example
A player completes an advancement · no
on advancement:
if event.advancement is "story/mine_diamond":
broadcast "&b%player.name% found diamonds!"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.advancement%text The 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
event on player kill:since 1.7.0 example
One player kills another; the player is the killer · no
on player kill:
grant advancement "first kill" to playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.victim%victimtext The name of the player who died
%event.location%location Where the victim died
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on projectile shoot:since 1.7.0 example
A player shoots or throws something · yes
on projectile shoot:
if entity is "ender_pearl" and {%player%.in_combat}:
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.entity%entitytext What 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
event on projectile hit:since 1.7.0 example
Something a player shot lands · no
on projectile hit:
if entity is "snowball" and victim is set:
send "&bSplat! You hit %event.victim%"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.entity%entitytext What was shot, e.g. arrow
%event.victim%victimtext Who or what was hit: a player's name or a mob type; unset for a block
%event.location%location Where it landed
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on totem use:since 1.7.0 example
A totem of undying saves a player · yes
on totem use:
broadcast "&6%player.name% cheated death!"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.location%location Where the player is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on block burn:since 1.7.0 example
Fire destroys a block · yes
on block burn:
if region at event's location contains "spawn":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.block%blocktext The block being burnt
%event.location%location Where the block is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on explosion:since 1.7.0 example
Something explodes · yes
on explosion:
if entity is "creeper":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.entity%entitytext What exploded, e.g. creeper or primed_tnt
%event.location%location Where it exploded
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on leaves decay:since 1.7.0 example
Leaves disappear after a tree is cut · yes
on leaves decay:
if region at event's location contains "park":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.block%blocktext The kind of leaves
%event.location%location Where they are
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on redstone:since 1.7.63 example
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%"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.block%blocktext The block whose power changed
%event.power%number The power it has now, 0 to 15
%event.location%location Where the block is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on piston extend:since 1.7.63 example
A piston pushes out · yes
on piston extend:
if region at event's location contains "spawn":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.block%blocktext The piston: piston or sticky_piston
%event.location%location Where the piston is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on piston retract:since 1.7.63 example
A piston pulls back · yes
on piston retract:
if region at event's location contains "spawn":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.block%blocktext The piston: piston or sticky_piston
%event.location%location Where the piston is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on dispense:since 1.7.63 example
A dispenser or dropper puts out an item · yes
on dispense:
if event.item is "tnt":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.block%blocktext The block: dispenser or dropper
%event.item%itemtext What it puts out
%event.location%location Where the block is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on hopper move:since 1.7.63 example
A hopper or the like moves an item between containers · yes
on hopper move:
if event.item is "diamond":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.item%itemtext The item that is moved
%event.location%location Where it is going
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on crop grow:since 1.7.0 example
A crop or plant grows a stage · yes
on crop grow:
if {season} is "winter":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.block%blocktext The plant, e.g. wheat
%event.location%location Where it is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on bucket fill:since 1.7.0 example
A player fills a bucket · yes
on bucket fill:
if region at player's location contains "spawn":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The bucket being used
Can be cancelled: Yes
player is: The player
More about on bucket fill:, with a box to try it in
event on bucket empty:since 1.7.0 example
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."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The 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
event on weather change:since 1.7.0 example
Rain starts or stops in a world · yes
on weather change:
if event.weather is "rain":
cancel eventCopy Try it
event on entity tame:since 1.7.0 example
A player tames an animal · yes
on entity tame:
send "&aYou tamed a %event.entity%!"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.entity%entitytext The 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
event on entity breed:since 1.7.0 example
Two animals have a baby · yes
on entity breed:
if player is set:
add 1 to {%player%.animals_bred}Copy Try it
event on shear:since 1.7.0 example
A player shears a sheep · yes
on shear:
add 1 to {%player%.sheep_sheared}Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.entity%entitytext What was sheared, e.g. sheep
Can be cancelled: Yes
player is: The player
More about on shear:, with a box to try it in
event on mob target:since 1.7.0 example
A mob picks a player as its target · yes
on mob target:
if player is vanished:
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.entity%entitytext The 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
event on player move:since 1.7.2 example
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 playerCopy Try it
event on portal use:since 1.7.2 example
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."Copy Try it
event on bed leave:since 1.7.2 example
A player gets out of a bed · no
on bed leave:
send "&eGood morning, %player.name%!"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The 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
event on item damage:since 1.7.2 example
An item a player is using loses durability · yes
on item damage:
if player has permission "tools.unbreaking":
cancel eventCopy Try it
event on harvest:since 1.7.2 example
A player picks berries or the like from a block without breaking it · yes
on harvest:
add 1 to {%player%.harvests}Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The 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
event on glide toggle:since 1.7.2 example
A player starts or stops gliding with an elytra · yes
on glide toggle:
if region at player's location contains "spawn":
cancel eventCopy Try it
event on entity mount:since 1.7.2 example
A player gets onto a creature or vehicle · yes
on entity mount:
send action bar "&7Sneak to get off" to playerCopy Try it
event on entity dismount:since 1.7.2 example
A player gets off what they were riding · yes
on entity dismount:
add 1 to {%player%.rides}Copy Try it
event on vehicle enter:since 1.7.0 example
A player gets into a vehicle · yes
on vehicle enter:
send action bar "&7Hold on tight" to playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.entity%entitytext The 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
event on vehicle exit:since 1.7.0 example
A player gets out of a vehicle · yes
on vehicle exit:
log "%player.name% left a %event.entity%"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.entity%entitytext The vehicle
Can be cancelled: Yes
player is: The player
More about on vehicle exit:, with a box to try it in
event on inventory open:since 1.7.0 example
A player opens a container · yes
on inventory open:
if event.inventory is "ender_chest" and {%player%.in_combat}:
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.inventory%text The kind of container: chest, furnace, anvil and so on
%event.location%location Where the container stands; unset for one that stands nowhere, such as an ender chest or a menu a script opened
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on inventory close:since 1.7.0 example
A player closes a container · no
on inventory close:
delete {%player%.shop_page}Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.inventory%text The 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
event on enchant item:since 1.7.0 example
A player enchants an item at a table · yes
on enchant item:
add 1 to {%player%.enchants}Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The item being enchanted
%event.level%number How many levels it costs
Can be cancelled: Yes
player is: The player
More about on enchant item:, with a box to try it in
event on furnace smelt:since 1.7.0 example
A furnace finishes smelting an item · yes
on furnace smelt:
add 1 to {smelted.%event.item%}Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.item%itemtext What comes out, e.g. iron_ingot
%event.location%location Where the furnace is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on console command:since 1.7.0 example
A command is run from the console · yes
on console command:
if command is "stop":
broadcast "&cThe server is shutting down."Copy Try it
event on shield block:since 1.7.1 example
A player's raised shield takes a blow completely · no
on shield block:
add 1 to {%player%.blocks_made}Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.attacker%attackertext Who 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
event on anvil use:since 1.7.1 example
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."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The 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
event on villager trade:since 1.7.1 example
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 playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext What 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
event on server start:since 1.7.0 example
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."Copy Try it
event on server stop:since 1.7.0 example
Once, as the server shuts down · no
on server stop:
set {last_shutdown} to nowCopy Try it
event on player quit:example
A player leaves · no
on player quit:
hide quit messageCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The 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
event on player login:since 1.5.7 example
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!"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.name%text The name of the player logging in
%event.uuid%text Their account id
%event.address%text The 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
event on player death:since 1.5.6 example
A player dies · Paper only
on player death:
subtract 5 from {%player%.coins}
send "&cYou died and lost 5 coins."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.message%messagetext The death message everyone will see
%event.killer%killertext Name of the player who made the kill; unset if none
%event.cause%causetext What killed the player: FALL, LAVA, ENTITY_ATTACK and so on
%event.location%location Where the player died
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on player respawn:since 1.5.6 example
A player comes back after dying · no
on player respawn:
make player invulnerable for 5 secondsCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.location%location Where the player is about to appear
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on item pickup:since 1.5.6 example
A player picks an item up off the ground · yes
on item pickup:
if item is "diamond":
add amount to {%player%.diamonds_found}Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The type of item, e.g. diamond
%event.amount%amountnumber How many items are in the stack
%event.location%location Where the player is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on item drop:since 1.5.6 example
A player drops an item · yes
on item drop:
if item is "compass":
cancel event
send "&cYou cannot drop your compass."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The type of item, e.g. diamond
%event.amount%amountnumber How many items are in the stack
%event.location%location Where the player is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on world change:since 1.5.6 example
A player arrives in another world · no
on world change:
send "&7You left &f%event.from% &7for &f%player.world%"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%player.world%text World the player is in
%event.from%text The name of the world the player left
%event.location%location Where the player is now
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on player command:since 1.5.6 example
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."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.command%commandtext The command without the slash, in lower case: home
%event.message%messagetext The whole line as typed: /home set base
%event.location%location Where the player is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on block break:example
A player breaks a block · yes
enchantment prospector:
on block break:
if event.block is "stone":
if chance of 5%:
give player 1 gold nuggetCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.block%blocktext The block type, e.g. diamond_ore
%event.location%location Where the block is
%event.drops%list The items the block will drop with the tool in the player's hand
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on block place:since 1.5.8 example
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."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.block%blocktext The block type placed, e.g. tnt
%event.location%location Where the block was placed
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on sign change:since 1.5.8 example
A player finishes writing on a sign · yes
on sign change:
if item 1 of event.lines is "[Shop]":
send "&aShop sign created."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.lines%list The lines of text, top to bottom
%event.block%blocktext The kind of sign, e.g. oak_sign
%event.location%location Where the sign is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on player teleport:since 1.5.8 example
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."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.cause%causetext COMMAND, PLUGIN, ENDER_PEARL, NETHER_PORTAL and so on
%event.location%location Where the player is going
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on entity click:since 1.5.8 example
A player right-clicks a mob, animal or player · yes
on entity click:
make event entity glow for player for 10 secondsCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.entity%entitytext The type clicked, e.g. villager or player
%event.clicked%text A player's name if a player was clicked, otherwise the type
%event.location%location Where the clicked entity is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on craft:since 1.5.8 example
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."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The item being crafted, e.g. diamond_sword
%event.amount%amountnumber How many one craft makes
Can be cancelled: Yes
player is: The player crafting
More about on craft:, with a box to try it in
event on consume:since 1.5.8 example
A player finishes eating or drinking · yes
on consume:
if item is "golden_apple":
apply speed 2 to player for 10 secondsCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext What 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
event on fish:since 1.5.8 example
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 playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext What was caught, e.g. cod
%event.amount%amountnumber How many
Can be cancelled: Yes
player is: The player fishing
More about on fish:, with a box to try it in
event on level up:since 1.5.8 example
A player's experience level goes up · no
on level up:
play particle effect "level up" at playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.level%number The level just reached
%event.old_level%number The 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
event on bed enter:since 1.5.8 example
A player gets into a bed · yes
on bed enter:
set {%player%.bed} to event's location
send "&7Sleep well."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.location%location Where the bed is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on region enter:since 1.5.8 example
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 playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.region%text The name of the region entered
%event.location%location Where the player now is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on region leave:since 1.5.8 example
A player leaves a script region · no
on region leave:
if event.region is "spawn":
send action bar "&cYou left the safe zone" to playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.region%text The name of the region left
%event.location%location Where the player now is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on combat start:since 1.7.50 example
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 combatCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.opponent%text The 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
event on combat end:since 1.7.50 example
The fight is over: nobody hit anybody for combat-time · no
on combat end:
send "&aYou are out of combat."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The 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
event on afk:since 1.7.50 example
A player has done nothing for afk-time · no
on afk:
broadcast "&7%player.name% is away."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The 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
event on afk return:since 1.7.50 example
A player who was away does something again · no
on afk return:
broadcast "&7%player.name% is back."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The 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
event on kill streak:since 1.7.52 example
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!"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.streak%number How many kills in a row this is: 1 for the first
%event.opponent%text The 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
event on blocked word:since 1.7.55 example
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"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.word%text The blocked word that was found
%event.message%text What 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
event on brew:since 1.7.55 example
A brewing stand finishes brewing; there is no player · yes
on brew:
spawn particle "witch" count 20 at event.locationCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.location%location Where the brewing stand is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on entity death:example
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}Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.entity%entitytext The type of entity that died
%event.killer%killertext Name 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
event on player chat:example
A player sends a chat message · yes
on player chat:
set chat format to "&7%player.name% &8>> &f%event.message%"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.message%messagetext The text of the message
%event.recipients%list Names 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
event on right click:example
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!"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The type of item in the player's hand; unset if empty
%event.block%blocktext The block clicked; unset when clicking air
%event.location%location Where the clicked block is; unset when clicking air
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on right click with <item>:since 1.7.14 example
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%"Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The type of item in the player's hand; unset if empty
%event.block%blocktext The block clicked; unset when clicking air
%event.location%location Where the clicked block is; unset when clicking air
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on right click on <block>:since 1.7.68 example
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."Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.item%itemtext The type of item in the player's hand; unset if empty
%event.block%blocktext The block clicked; unset when clicking air
%event.location%location Where the clicked block is; unset when clicking air
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on entity damage: (or on hit:)since 1.5.0 example
Any entity takes damage · yes
on entity damage:
show floating text "&c-%event.damage%" at victimCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.attacker%attackertext Who 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%victimtext Who was hurt: a player's name or a mob type
%event.damage%damagenumber Damage actually taken, after armour and effects; 2 is one heart
%event.cause%causetext Why: FALL, FIRE, ENTITY_ATTACK, PROJECTILE, DROWNING, VOID and so on
%event.entity%entitytext The victim's entity type, e.g. player or zombie
%event.location%location Where the victim is
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on player jump:since 1.5.0 example
A player jumps · yes
on player jump:
if {%player%.frozen} is true:
cancel event
send action bar "&cYou cannot jump while frozen!" to playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%player.world%text World the player is in
%player.location%location Where the player is standing
%event.location%location Where the jump started
x of player's locationnumber The x of %player.location%, as a number
y of player's locationnumber The y of %player.location%, as a number: how high it is
z of player's locationnumber The z of %player.location%, as a number
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on mob spawn:since 1.5.0 example
A living creature spawns · yes
on mob spawn:
if entity is "phantom" and reason is "NATURAL":
cancel eventCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.entity%entitytext The type of creature, e.g. zombie
%event.reason%reasontext Why it spawned: NATURAL, SPAWNER, SPAWNER_EGG, BREEDING, CUSTOM and so on
%event.location%location Where it spawns
x of event's locationnumber The x of %event.location%, as a number
y of event's locationnumber The y of %event.location%, as a number: how high it is
z of event's locationnumber The 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
event on inventory click:since 1.5.0 example
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 playerCopy Try it What this event gives a script
Placeholder Short form Type Meaning
%player%playerplayer The player the event is about; use it wherever a player is expected
%event.slot%slotnumber The 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%itemtext The type of item in that slot; unset if it is empty
%event.click_type%text How 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
event on server ping:since 1.5.2 example
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"]Copy Try it What this event gives a script
Placeholder Short form Type Meaning
%event.address%text The IP address of the client asking
%server.motd%text The MOTD from server.properties
%server.online_players%number Players online right now
%server.max_players%number The 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
event on resource pack accept:since 1.4.0 example
A player agrees to download a resource pack · no
on resource pack accept:
send action bar "&aDownloading server resource pack..." to playerCopy Try it
event on resource pack decline:since 1.4.0 example
A player refuses a resource pack · no
on resource pack decline:
send "&cSome custom items may look wrong without the pack." to playerCopy Try it
event on resource pack successfully loaded:since 1.4.0 example
A player's game has finished applying the pack · no
on resource pack successfully loaded:
send "&aResource pack loaded!" to playerCopy Try it
event on resource pack failed:since 1.4.0 example
The download or the pack itself failed · no
on resource pack failed:
send "&cThe resource pack failed to load." to playerCopy Try it
Guide and examples
Event Fires when Can be cancelled
on player join:A player joins no
on first join:Someone joins who has never played here before no
on left click:A player left-clicks air or a block yes
on player sneak:A player starts sneaking yes
on player sprint:A player starts sprinting yes
on player swim:A player starts swimming yes
on flight toggle:A player starts or stops flying yes
on hand swap:A player swaps the items in their hands yes
on slot change:A player selects another hotbar slot yes
on item break:A player's tool or armour breaks no
on book edit:A player writes in or signs a book yes
on gamemode change:A player's game mode is about to change yes
on hunger change:A player's hunger bar changes yes
on player heal:A player regains health yes
on experience gain:A player gains experience points no
on effect gained:A player gets a potion effect yes
on effect ended:A potion effect on a player ends yes
on player kick:A player is about to be kicked yes
on advancement:A player completes an advancement no
on player kill:One player kills another; the player is the killer no
on projectile shoot:A player shoots or throws something yes
on projectile hit:Something a player shot lands no
on totem use:A totem of undying saves a player yes
on block burn:Fire destroys a block yes
on explosion:Something explodes yes
on leaves decay:Leaves disappear after a tree is cut yes
on redstone:The redstone power of a block changes no
on piston extend:A piston pushes out yes
on piston retract:A piston pulls back yes
on dispense:A dispenser or dropper puts out an item yes
on hopper move:A hopper or the like moves an item between containers yes
on crop grow:A crop or plant grows a stage yes
on bucket fill:A player fills a bucket yes
on bucket empty:A player empties a bucket yes
on weather change:Rain starts or stops in a world yes
on entity tame:A player tames an animal yes
on entity breed:Two animals have a baby yes
on shear:A player shears a sheep yes
on mob target:A mob picks a player as its target yes
on player move:A player moves into another block; runs very often, so keep it short yes
on portal use:A player is about to go through a nether or end portal yes
on bed leave:A player gets out of a bed no
on item damage:An item a player is using loses durability yes
on harvest:A player picks berries or the like from a block without breaking it yes
on glide toggle:A player starts or stops gliding with an elytra yes
on entity mount:A player gets onto a creature or vehicle yes
on entity dismount:A player gets off what they were riding yes
on vehicle enter:A player gets into a vehicle yes
on vehicle exit:A player gets out of a vehicle yes
on inventory open:A player opens a container yes
on inventory close:A player closes a container no
on enchant item:A player enchants an item at a table yes
on furnace smelt:A furnace finishes smelting an item yes
on console command:A command is run from the console yes
on shield block:A player's raised shield takes a blow completely no
on anvil use:A player takes the finished item out of an anvil yes
on villager trade:A player takes the goods out of a trade yes
on server start:Once, when the server has started and every script is loaded; not on a reload no
on server stop:Once, as the server shuts down no
on player quit:A player leaves no
on player login:Someone is connecting, before they are in the game; see Moderation with refuse login
on player death:A player dies Paper only
on player respawn:A player comes back after dying no
on item pickup:A player picks an item up off the ground yes
on item drop:A player drops an item yes
on world change:A player arrives in another world no
on player command:A player types any command, before the server runs it yes
on block break:A player breaks a block yes
on block place:A player places a block yes
on sign change:A player finishes writing on a sign yes
on player teleport:A player is about to be teleported yes
on entity click:A player right-clicks a mob, animal or player yes
on craft:A player takes the result out of a crafting grid yes
on consume:A player finishes eating or drinking yes
on fish:A player reels in a catch yes
on level up:A player's experience level goes up no
on bed enter:A player gets into a bed yes
on region enter:A player comes into a script region; see Worlds and regions no
on region leave:A player leaves a script region no
on combat start:A player gets into a fight with another player; see Combat and being away no
on combat end:The fight is over: nobody hit anybody for combat-time no
on afk:A player has done nothing for afk-time no
on afk return:A player who was away does something again no
on kill streak:A player kills another player; %event.streak% is how many in a row no
on blocked word:A player writes a word in chat that a script blocked; %event.word% is the word no
on brew:A brewing stand finishes brewing; there is no player yes
on entity death:Any living entity dies; the player is the killer, if there was one Paper only
on player chat:A player sends a chat message yes
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>: likewise yes
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 damage yes
on player jump:A player jumps yes
on mob spawn:A living creature spawns yes
on inventory click:A player clicks in an inventory window yes
on server ping:A client refreshes its server list; see Server list no
on resource pack accept:A player agrees to download a resource pack no
on resource pack decline:A player refuses a resource pack no
on resource pack successfully loaded:A player's game has finished applying the pack no
on resource pack failed:The download or the pack itself failed no
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.