Events

At Time

🔗

Event

Patterns:
Since: 1.3.4
An event that occurs at a given minecraft time in every world or only in specific worlds.

Examples:

at 18:00
at 7am in "world"

On Anvil Damage

🔗

Event

Patterns:
  • [on] anvil damag(e|ing)
Since: 2.7
Requirements: Paper
Called when an anvil is damaged/broken from being used to repair/rename items. Note: this does not include anvil damage from falling.

Examples:

on anvil damage:
    cancel the event

On Anvil Prepare

🔗

Event

Patterns:
  • [on] anvil prepar(e|ing)
Since: 2.7
Called when an item is put in a slot for repair by an anvil. Please note that this event is called multiple times in a single item slot move.

Examples:

on anvil prepare:
    event-item is set # result item
    chance of 5%:
        set repair cost to repair cost * 50%
        send "You're LUCKY! You got 50% discount." to player

On AoE Cloud Effect

🔗

Event

Patterns:
  • [on] (area|AoE) [cloud] effect
Since: 2.2-dev21
Called when area effect cloud applies its potion effect. This happens every 5 ticks by default.

Examples:

on area cloud effect:

On Arm Swing

🔗

Event

Patterns:
  • [on] [player] arm swing
Since: 2.5.1
Called when a player swings his arm.

Examples:

on arm swing:
    send "You swung your arm!"

On Armor Change

🔗

Event

Patterns:
  • [on] [player] armor change[d]
Since: 2.5
Requirements: Paper
Called when armor pieces of a player are changed.

Examples:

on armor change:
    send "You equipped %event-item%!"

On Bed Enter

🔗

Event

Patterns:
  • [on] bed enter[ing]
  • [on] [player] enter[ing] [a] bed
Since: 1.0
Called when a player starts sleeping.

Examples:

on bed enter:

On Bed Leave

🔗

Event

Patterns:
  • [on] bed leav(e|ing)
  • [on] [player] leav(e|ing) [a] bed
Since: 1.0
Called when a player leaves a bed.

Examples:

on player leaving a bed:

On Block Damage

🔗

Event

Patterns:
  • [on] block damag(ing|e)
Since: 1.0
Called when a player starts to break a block. You can usually just use the leftclick event for this.

Examples:

on block damaging:
    if block is log:
        send "You can't break the holy log!"

On Block Fertilize

🔗

Event

Patterns:
  • [on] [block] fertilize
Since: 2.5
Requirements: Minecraft 1.13 or newer
Called when a player fertilizes blocks.

Examples:

on block fertilize:
    send "Fertilized %size of fertilized blocks% blocks got fertilized."

On Block Growth

🔗

Event

Patterns:
  • [on] (plant|crop|block) grow[(th|ing)] [[of] %item types%]
Since: 2.2-Fixes-V10
Called when a crop grows. Alternative to new form of generic grow event.

Examples:

on crop growth:

On Book Edit

🔗

Event

Patterns:
  • [on] book (edit|change|write)
Since: 2.2-dev31
Called when a player edits a book.

Examples:

on book edit:

On Book Sign

🔗

Event

Patterns:
  • [on] book sign[ing]
Since: 2.2-dev31
Called when a player signs a book.

Examples:

on book sign:

On Break / Mine

🔗

Event

Patterns:
Since: 1.0 (break), unknown (mine), 2.6 (BlockData support)
Called when a block is broken by a player. If you use 'on mine', only events where the broken block dropped something will call the trigger.

Examples:

on mine:
on break of stone:
on mine of any ore:
on break of chest[facing=north]:
on break of potatoes[age=7]:

On Bucket Empty

🔗

Event

Patterns:
  • [on] bucket empty[ing]
  • [on] [player] empty[ing] [a] bucket
Since: 1.0
Called when a player empties a bucket. You can also use the place event with a check for water or lava.

Examples:

on bucket empty:

On Bucket fill

🔗

Event

Patterns:
  • [on] bucket fill[ing]
  • [on] [player] fill[ing] [a] bucket
Since: 1.0
Called when a player fills a bucket.

Examples:

on player filling a bucket:

On Burn

🔗

Event

Patterns:
Since: 1.0, 2.6 (BlockData support)
Called when a block is destroyed by fire.

Examples:

on burn:
on burn of wood, fences, or chests:
on burn of oak_log[axis=y]:

On Can Build Check

🔗

Event

Patterns:
  • [on] [block] can build check
Since: 1.0 (basic), 2.0 ([un]cancellable)
Called when a player rightclicks on a block while holding a block or a placeable item. You can either cancel the event to prevent the block from being built, or uncancel it to allow it. Please note that the data value of the block to be placed is not available in this event, only its ID.

Examples:

on block can build check:
    cancel event

On Chat

🔗

Event

Patterns:
  • [on] chat
Since: 1.4.1
Called whenever a player chats. Use chat format to change message format. Use chat recipients to edit chat recipients.

Examples:

on chat:
    if player has permission "owner":
        set chat format to "<red>[player]<light gray>: <light red>[message]"
    else if player has permission "admin":
        set chat format to "<light red>[player]<light gray>: <orange>[message]"
    else: #default message format
        set chat format to "<orange>[player]<light gray>: <white>[message]"

On Chunk Generate

🔗

Event

Patterns:
  • [on] chunk (generat|populat)(e|ing)
Since: 1.0
Called after a new chunk was generated.

Examples:

on chunk generate:

On Chunk Load

🔗

Event

Patterns:
  • [on] chunk load[ing]
Since: 1.0
Called when a chunk loads. The chunk might or might not contain mobs when it's loaded.

Examples:

on chunk load:

On Chunk Unload

🔗

Event

Patterns:
  • [on] chunk unload[ing]
Since: 1.0
Called when a chunk is unloaded due to not being near any player.

Examples:

on chunk unload:

On Click

🔗

Event

Patterns:
Since: 1.0
Called when a user clicks on a block, an entity or air with or without an item in their hand. Please note that rightclick events with an empty hand while not looking at a block are not sent to the server, so there's no way to detect them. Also note that a leftclick on an entity is an attack and thus not covered by the 'click' event, but the 'damage' event.

Examples:

on click:
on rightclick holding a fishing rod:
on leftclick on a stone or obsidian:
on rightclick on a creeper:
on click with a sword:

On Combust

🔗

Event

Patterns:
  • [on] combust[ing]
Since: 1.0
Called when an entity is set on fire, e.g. by fire or lava, a fireball, or by standing in direct sunlight (zombies, skeletons).

Examples:

on combust:

On Command

🔗

Event

Patterns:
  • [on] command [%text%]
Since: 2.0
Called when a player enters a command (not necessarily a Skript command) but you can check if command is a skript command, see Is a Skript command condition.

Examples:

on command:
on command "/stop":
on command "pm Njol ":

On Connect

🔗

Event

Patterns:
  • [on] [player] connect[ing]
Since: 2.0
Called when the player connects to the server. This event is called before the player actually joins the server, so if you want to prevent players from joining you should prefer this event over on join.

Examples:

on connect:
    player doesn't have permission "VIP"
    number of players is greater than 15
    kick the player due to "The last 5 slots are reserved for VIP players."

On Consume

🔗

Event

Patterns:
  • [on] [player] ((eat|drink)[ing]|consum(e|ing)) [[of] %item types%]
Since: 2.0
Called when a player is done eating/drinking something, e.g. an apple, bread, meat, milk or a potion.

Examples:

on consume:

On Craft

🔗

Event

Patterns:
Since: unknown (before 2.1)
Called when a player crafts an item.

Examples:

on craft:

On Creeper Power

🔗

Event

Patterns:
  • [on] creeper power
Since: 1.0
Called when a creeper is struck by lighting and gets powered. Cancel the event to prevent the creeper from being powered.

Examples:

on creeper power:

On Damage

🔗

Event

Patterns:
Since: 1.0, 2.7 (by entity)
Called when an entity receives damage, e.g. by an attack from another entity, lava, fire, drowning, fall, suffocation, etc.

Examples:

on damage:
on damage of a player:
on damage of player by zombie:

On Death

🔗

Event

Patterns:
Since: 1.0
Called when a living entity (including players) dies.

Examples:

on death:
on death of player:
on death of a wither or ender dragon:
    broadcast "A %entity% has been slain in %world%!"

On Dispense

🔗

Event

Patterns:
Since: unknown (before 2.1)
Called when a dispenser dispenses an item.

Examples:

on dispense of iron block:
    send "that'd be 19.99 please!"

On Drop

🔗

Event

Patterns:
  • [on] [player|entity] drop[ping] [[of] %item types%]
Since: unknown (before 2.1), 2.7 (entity)
Called when a player drops an item from their inventory, or an entity drops an item, such as a chicken laying an egg.

Examples:

on drop:
    if event-item is compass:
        cancel event

on entity drop of an egg:
    if event-entity is a chicken:
        set item of event-dropped item to a diamond

On Egg Throw

🔗

Event

Patterns:
  • [on] throw[ing] [of] [an] egg
  • [on] [player] egg throw
Since: 1.0
Called when a player throws an egg and it lands. You can just use the shoot event in most cases. However, this event allows modification of properties like the hatched entity type and the number of entities to hatch.

Examples:

on throw of an egg:

On Enchant

🔗

Event

Patterns:
  • [on] [item] enchant
Since: 2.5
Called when a player successfully enchants an item. To get the enchanted item, see the enchant item expression

Examples:

on enchant:
    if the clicked button is 1: # offer 1
        set the applied enchantments to sharpness 10 and unbreaking 10

On Enchant Prepare

🔗

Event

Patterns:
  • [on] [item] enchant prepare
Since: 2.5
Called when a player puts an item into enchantment table. This event may be called multiple times. To get the enchant item, see the enchant item expression

Examples:

on enchant prepare:
    set enchant offer 1 to sharpness 1
    set the cost of enchant offer 1 to 10 levels

On Enderman/Sheep/Silverfish/Falling Block

🔗

Event

Patterns:
  • [on] enderman place
  • [on] enderman pickup
  • [on] sheep eat
  • [on] silverfish enter
  • [on] silverfish exit
  • [on] falling block land[ing]
Since: unknown, 2.5.2 (falling block)
Called when an enderman places or picks up a block, a sheep eats grass, a silverfish boops into/out of a block or a falling block lands and turns into a block respectively.

Examples:

on sheep eat:
    kill entity
    broadcast "A sheep stole some grass!"
on falling block land:
    if event-entity is a falling dirt:
        cancel event

On Entity Dismount

🔗

Event

Patterns:
  • [on] dismount[ing]
Since: 2.2-dev13b
Called when an entity dismounts.

Examples:

on dismount:
    kill event-entity

On Entity Jump

🔗

Event

Patterns:
  • [on] entity jump[ing]
Since: 2.7
Requirements: Paper 1.15.2+
Called when an entity jumps.

Examples:

on entity jump:
    if entity is a wither skeleton:
        cancel event

On Entity Mount

🔗

Event

Patterns:
  • [on] mount[ing]
Since: 2.2-dev13b
Called when entity starts riding another.

Examples:

on mount:
    cancel event

On Entity Portal

🔗

Event

Patterns:
  • [on] entity portal
Since: 2.5.3
Called when an entity uses a nether or end portal. Cancel the event to prevent the entity from teleporting.

Examples:

on entity portal:
    broadcast "A %type of event-entity% has entered a portal!

On Experience Change

🔗

Event

Patterns:
  • [on] [player] (level progress|[e]xp|experience) (change|update|increase|decrease)
Since: 2.7
Called when a player's experience changes.

Examples:

on level progress change:
    set {_xp} to event-experience
    broadcast "%{_xp}%"

On Experience Spawn

🔗

Event

Patterns:
  • [on] [e]xp[erience] [orb] spawn
  • [on] spawn of [a[n]] [e]xp[erience] [orb]
Since: 2.0
Called whenever experience is about to spawn. Please note that this event will not fire for xp orbs spawned by plugins (including Skript) with Bukkit.

Examples:

on xp spawn:
    world is "minigame_world"
    cancel event

On Explode

🔗

Event

Patterns:
  • [on] explo(d(e|ing)|sion)
Since: 1.0
Called when an entity (a primed TNT or a creeper) explodes.

Examples:

on explosion:

On Explosion Prime

🔗

Event

Patterns:
  • [on] explosion prime
Since: 1.0
Called when an explosive is primed, i.e. an entity will explode shortly. Creepers can abort the explosion if the player gets too far away, while TNT will explode for sure after a short time.

Examples:

on explosion prime:

On Fade

🔗

Event

Patterns:
Since: 1.0, 2.6 (BlockData support)
Called when a block 'fades away', e.g. ice or snow melts.

Examples:

on fade of snow or ice:
on fade of snow[layers=2]

On Firework Explode

🔗

Event

Patterns:
  • [on] [a] firework explo(d(e|ing)|sion) [colo[u]red %colors%]
Since: 2.4
Called when a firework explodes.

Examples:

on firework explode
on firework exploding colored red, light green and black
on firework explosion colored light green:
    broadcast "A firework colored %colors% was exploded at %location%!"

On First Join

🔗

Event

Patterns:
  • [on] first (join|login)
Since: 1.3.7
Called when a player joins the server for the first time.

Examples:

on first join:
    broadcast "Welcome %player% to the server!"

On Fishing

🔗

Event

Patterns:
  • [on] [player] fish[ing]
Since: 1.0
Called when a player fishes something. This is not of much use yet.

Examples:

on fish:

On Flight Toggle

🔗

Event

Patterns:
  • [on] [player] flight toggl(e|ing)
  • [on] [player] toggl(e|ing) flight
Since: 2.2-dev36
Called when a players stops/starts flying.

Examples:

on flight toggle:
    if {game::%player%::playing} exists:
        cancel event

On Flow

🔗

Event

Patterns:
  • [on] [block] flow[ing]
  • [on] block mov(e|ing)
Since: 1.0
Called when a blocks flows or teleports to another block. This not only applies to water and lava, but teleporting dragon eggs as well.

Examples:

on block flow:
    if event-block is water:
        broadcast "Build more dams! It's starting to get wet in here"

On Form

🔗

Event

Patterns:
Since: 1.0, 2.6 (BlockData support)
Called when a block is created, but not by a player, e.g. snow forms due to snowfall, water freezes in cold biomes. This isn't called when block spreads (mushroom growth, water physics etc.), as it has its own event (see spread event).

Examples:

on form of snow:
on form of a mushroom:

On Fuel Burn

🔗

Event

Patterns:
  • [on] fuel burn[ing]
Since: 1.0
Called when a furnace burns an item from its fuel slot.

Examples:

on fuel burning:

On Gamemode Change

🔗

Event

Patterns:
  • [on] game[ ]mode change [to %gamemode%]
Since: 1.0
Called when a player's gamemode changes.

Examples:

on gamemode change:
on gamemode change to adventure:

On Gliding State Change

🔗

Event

Patterns:
  • [on] (gliding state change|toggl(e|ing) gliding)
Since: 2.2-dev21
Called when an entity toggles glider on or off, or when server toggles gliding state of an entity forcibly.

Examples:

on toggling gliding:
    cancel the event # bad idea, but you CAN do it!

On Grow

🔗

Event

Patterns:
Since: 1.0 (2.2-dev20 for plants)
Called when a tree, giant mushroom or plant grows to next stage.

Examples:

on grow:
on grow of a tree:
on grow of a huge jungle tree:

On Hand Item Swap

🔗

Event

Patterns:
  • [on] swap[ping of] [(hand|held)] item[s]
Since: 2.3
Called whenever a player swaps the items in their main- and offhand slots. Works also when one or both of the slots are empty. The event is called before the items are actually swapped, so when you use the player's tool or player's offtool expressions, they will return the values before the swap - this enables you to cancel the event before anything happens.

Examples:

on swap hand items:
    event-player's tool is a diamond sword
    cancel event

On Heal

🔗

Event

Patterns:
  • [on] heal[ing]
Since: 1.0
Called when an entity is healed, e.g. by eating (players), being fed (pets), or by the effect of a potion of healing (overworld mobs) or harm (nether mobs).

Examples:

on heal:

On Horse Jump

🔗

Event

Patterns:
  • [on] horse jump
Since: 2.5.1
Called when a horse jumps.

Examples:

on horse jump:
    push event-entity upwards at speed 2

On Hunger Meter Change

🔗

Event

Patterns:
  • [on] (food|hunger) (level|met(er|re)|bar) chang(e|ing)
Since: 1.4.4
Called when the hunger bar of a player changes, i.e. either increases by eating or decreases over time.

Examples:

on food bar change:

On Ignition

🔗

Event

Patterns:
  • [on] [block] ignit(e|ion)
Since: 1.0
Called when a block starts burning, i.e. a fire block is placed next to it and this block is flammable. The burn event will be called when the block is about do be destroyed by the fire.

Examples:

on block ignite:
    if event-block is a ladder:
        cancel event

On Inventory Click

🔗

Event

Patterns:
  • [on] [player] inventory(-| )click[ing] [[at] %item types%]
Since: 2.2-Fixes-V10
Called when clicking on inventory slot.

Examples:

on inventory click:
    if event-item is stone:
        give player 1 stone
        remove 20$ from player's balance

On Inventory Close

🔗

Event

Patterns:
  • [on] inventory clos(ing|e[d])
Since: 2.2-dev21
Called when player's currently viewed inventory is closed.

Examples:

on inventory close:
    if player's location is {location}:
        send "You exited the shop!"

On Inventory Open

🔗

Event

Patterns:
  • [on] inventory open[ed]
Since: 2.2-dev21
Called when an inventory is opened for player.

Examples:

on inventory open:
    close player's inventory

On Inventory Pickup

🔗

Event

Patterns:
  • [on] inventory pick[ ]up
Since: 2.5.1
Called when an inventory (a hopper, a hopper minecart, etc.) picks up an item

Examples:

on inventory pickup:

On Item Break

🔗

Event

Patterns:
  • [on] [player] tool break[ing]
  • [on] [player] break[ing] [(a|the)] tool
Since: 2.1.1
Called when a player breaks their tool because its damage reached the maximum value. This event cannot be cancelled.

Examples:

on tool break:

On Item Damage

🔗

Event

Patterns:
  • [on] item damag(e|ing)
Since: 2.5
Called when an item is damaged. Most tools are damaged by using them; armor is damaged when the wearer takes damage.

Examples:

on item damage:
    cancel event

On Item Despawn

🔗

Event

Patterns:
  • [on] (item[ ][stack]|[item] %item types%) despawn[ing]
  • [on] [item[ ][stack]] despawn[ing] [[of] %item types%]
Since: 2.2-dev35
Called when an item is about to be despawned from the world, usually 5 minutes after it was dropped.

Examples:

on item despawn of diamond:
    send "Not my precious!"
    cancel event

On Item Mend

🔗

Event

Patterns:
  • [on] item mend[ing]
Since: 2.5.1
Requirements: Minecraft 1.13 or newer
Called when a player has an item repaired via the Mending enchantment.

Examples:

on item mend:
    chance of 50%:
        cancel the event
        send "Oops! Mending failed!" to player

On Item Merge

🔗

Event

Patterns:
  • [on] (item[ ][stack]|[item] %item types%) merg(e|ing)
  • [on] item[ ][stack] merg(e|ing) [[of] %item types%]
Since: 2.2-dev35
Called when dropped items merge into a single stack. event-entity will be the entity which is trying to merge, and future event-entity will be the entity which is being merged into.

Examples:

on item merge of gold blocks:
    cancel event

On Item Spawn

🔗

Event

Patterns:
Since: unknown (before 2.1)
Called whenever an item stack is spawned in a world, e.g. as drop of a block or mob, a player throwing items out of their inventory, or a dispenser dispensing an item (not shooting it).

Examples:

on item spawn of iron sword:
    broadcast "Someone dropped an iron sword!"

On Join

🔗

Event

Patterns:
  • [on] [player] (login|logging in|join[ing])
Since: 1.0
Called when the player joins the server. The player is already in a world when this event is called, so if you want to prevent players from joining you should prefer on connect over this event.

Examples:

on join:
    message "Welcome on our awesome server!"
    broadcast "%player% just joined the server!"

On Jump

🔗

Event

Patterns:
  • [on] [player] jump[ing]
Since: 2.3
Called whenever a player jumps. This event requires PaperSpigot.

Examples:

on jump:
    event-player does not have permission "jump"
    cancel event

On Kick

🔗

Event

Patterns:
  • [on] [player] (kick|being kicked)
Since: 1.0
Called when a player is kicked from the server. You can change the kick message or cancel the event entirely.

Examples:

on kick:

On Language Change

🔗

Event

Patterns:
  • [on] [player] (language|locale) chang(e|ing)
  • [on] [player] chang(e|ing) (language|locale)
Since: 2.3
Called after a player changed their language in the game settings. You can use the language expression to get the current language of the player. This event requires Minecraft 1.12+.

Examples:

on language change:
    if player's language starts with "en":
        send "Hello!"

On Leaves Decay

🔗

Event

Patterns:
  • [on] leaves decay[ing]
Since: 1.0
Called when a leaf block decays due to not being connected to a tree.

Examples:

on leaves decay:

On Level Change

🔗

Event

Patterns:
  • [on] [player] level (change|up|down)
Since: 1.0, 2.4 (level up/down)
Called when a player's level changes, e.g. by gathering experience or by enchanting something.

Examples:

on level change:

On Lightning Strike

🔗

Event

Patterns:
  • [on] lightning [strike]
Since: 1.0
Called when lightning strikes.

Examples:

on lightning:
    spawn a zombie at location of event-entity

On Loot Generate

🔗

Event

Patterns:
  • [on] loot generat(e|ing)
Since: 2.7
Requirements: MC 1.16+
Called when a loot table of an inventory is generated in the world. For example, when opening a shipwreck chest.

Examples:

on loot generate:
    chance of %10
    add 64 diamonds
    send "You hit the jackpot!!"

On Move

🔗

Event

Patterns:
Since: 2.6
Requirements: Paper 1.16.5+ (entity move)
Called when a player or entity moves. NOTE: Move event will only be called when the entity/player moves position, not orientation (ie: looking around). NOTE: These events can be performance heavy as they are called quite often. If you use these events, and later remove them, a server restart is recommended to clear registered events from Skript.

Examples:

on player move:
    if player does not have permission "player.can.move":
        cancel event
on skeleton move:
    if event-entity is not in world "world":
        kill event-entity

On Move On

🔗

Event

Patterns:
Since: 2.0
Called when a player moves onto a certain type of block. Please note that using this event can cause lag if there are many players online.

Examples:

on walking on dirt or grass:
on stepping on stone:

On Physics

🔗

Event

Patterns:
  • [on] [block] physics
Since: 1.4.6
Called when a physics check is done on a block. By cancelling this event you can prevent some things from happening, e.g. sand falling, dirt turning into grass, torches dropping if their supporting block is destroyed, etc.Please note that using this event might cause quite some lag since it gets called extremely often.

Examples:

# prevents sand from falling
on block physics:
    block is sand
    cancel event

On Pick Up

🔗

Event

Patterns:
  • [on] [(player|entity)] (pick[ ]up|picking up) [[of] %item types%]
Since: unknown (before 2.1), 2.5 (entity)
Requirements: 1.12.2+ for entity
Called when a player/entity picks up an item. Please note that the item is still on the ground when this event is called.

Examples:

on pick up:
on entity pickup of wheat:

On Pig Zap

🔗

Event

Patterns:
  • [on] pig[ ]zap
Since: 1.0
Called when a pig is stroke by lightning and transformed into a zombie pigman. Cancel the event to prevent the transformation.

Examples:

on pig zap:

On Piston Extend

🔗

Event

Patterns:
  • [on] piston extend[ing]
Since: 1.0
Called when a piston is about to extend.

Examples:

on piston extend:
    broadcast "A piston is extending!"

On Piston Retract

🔗

Event

Patterns:
  • [on] piston retract[ing]
Since: 1.0
Called when a piston is about to retract.

Examples:

on piston retract:
    broadcast "A piston is retracting!"

On Place

🔗

Event

Patterns:
Since: 1.0, 2.6 (BlockData support)
Called when a player places a block.

Examples:

on place:
on place of a furnace, workbench or chest:
on break of chest[type=right] or chest[type=left]

On Player Chunk Enters

🔗

Event

Patterns:
  • [on] player (enter[s] [a] chunk|chunk enter[ing])
Since: 2.7
Called when a player enters a chunk. Note that this event is based on 'player move' event, and may be called frequent internally.

Examples:

on player enters a chunk:
    send "You entered a chunk: %past event-chunk% -> %event-chunk%!" to player

On Player Deep Sleep

🔗

Event

Patterns:
  • [on] [player] deep sleep[ing]
Since: 2.7
Requirements: Paper 1.16+
Called when a player has slept long enough to count as passing the night/storm. Cancelling this event will prevent the player from being counted as deeply sleeping unless they exit and re-enter the bed.

Examples:

on player deep sleeping:
    send "Zzzz.." to player

On Player Trade

🔗

Event

Patterns:
  • [on] player trad(e|ing)
Since: 2.7
Requirements: Paper 1.16.5+
Called when a player has traded with a villager.

Examples:

on player trade:
    chance of 50%:
        cancel event
        send "The trade was somehow denied!" to player

On Player World Change

🔗

Event

Patterns:
  • [on] [player] world chang(ing|e[d])
Since: 2.2-dev28
Called when a player enters a world. Does not work with other entities!

Examples:

on player world change:
    world is "city"
    send "Welcome to the City!"

On Portal

🔗

Event

Patterns:
  • [on] [player] portal
Since: 1.0
Called when a player uses a nether or end portal. Cancel the event to prevent the player from teleporting.

Examples:

on player portal:

On Portal Create

🔗

Event

Patterns:
  • [on] portal creat(e|ion)
Since: 1.0, 2.5.3 (event-entity support)
Requirements: Minecraft 1.14+ (event-entity support)
Called when a portal is created, either by a player or mob lighting an obsidian frame on fire, or by a nether portal creating its teleportation target in the nether/overworld. In Minecraft 1.14+, you can use the player in this event. Please note that there may not always be a player (or other entity) in this event.

Examples:

on portal create:

On Portal Enter

🔗

Event

Patterns:
  • [on] portal enter[ing]
  • [on] entering [a] portal
Since: 1.0
Called when an entity enters a nether portal or an end portal. Please note that this event will be fired many times for a nether portal.

Examples:

on portal enter:

On Prepare Craft

🔗

Event

Patterns:
  • [on] [player] (preparing|beginning) craft[ing] [[of] %item types%]
Since: 2.2-Fixes-V10
Called just before displaying crafting result to player. Note that setting the result item might or might not work due to Bukkit bugs.

Examples:

on preparing craft of torch:

On Pressure Plate / Trip

🔗

Event

Patterns:
  • [on] [step[ping] on] [a] [pressure] plate
  • [on] (trip|[step[ping] on] [a] tripwire)
Since: 1.0 (pressure plate), 1.4.4 (tripwire)
Called when a player steps on a pressure plate or tripwire respectively.

Examples:

on step on pressure plate:

On Projectile Collide

🔗

Event

Patterns:
  • [on] projectile collide
Since: 2.5
Requirements: Paper
Called when a projectile collides with an entity.

Examples:

on projectile collide:
    teleport shooter of event-projectile to event-entity

On Projectile Hit

🔗

Event

Patterns:
  • [on] projectile hit
Since: 1.0
Called when a projectile hits an entity or a block. Use the damage event with a check for a projectile to be able to use the entity that got hit in the case when the projectile hit a living entity. A damage event will even be fired if the damage is 0, e.g. when throwing snowballs at non-nether mobs.

Examples:

on projectile hit:
    event-projectile is arrow
    delete event-projectile

On Quit

🔗

Event

Patterns:
  • [on] (quit[ting]|disconnect[ing]|log[ ]out|logging out|leav(e|ing))
Since: 1.0 (simple disconnection)
Called when a player leaves the server.

Examples:

on quit:
on disconnect:

On Redstone

🔗

Event

Patterns:
  • [on] redstone [current] [chang(e|ing)]
Since: 1.0
Called when the redstone current of a block changes. This event is of not much use yet.

Examples:

on redstone change:
    send "someone is using redstone" to console

On Region Enter/Leave

🔗

Event

Patterns:
  • [on] (enter[ing]|leav(e|ing)|exit[ing]) [of] ([a] region|[[the] region] %regions%)
  • [on] region (enter[ing]|leav(e|ing)|exit[ing])
Since: 2.1
Requirements: Supported regions plugin
Called when a player enters or leaves a region. This event requires a supported regions plugin to be installed.

Examples:

on region exit:
    message "Leaving %region%."

On Resource Pack Request Response

🔗

Event

Patterns:
Since: 2.4
Called when a player takes action on a resource pack request sent via the send resource pack effect. The resource pack condition can be used to check the resource pack state.

This event will be triggered once when the player accepts or declines the resource pack request, and once when the resource pack is successfully installed or failed to download.

Examples:

on resource pack request response:
    if the resource pack was declined or failed to download:

on resource pack deny:
    kick the player due to "You have to install the resource pack to play in this server!"

On Respawn

🔗

Event

Patterns:
  • [on] [player] respawn[ing]
Since: 1.0
Called when a player respawns. You should prefer this event over the death event as the player is technically alive when this event is called.

Examples:

on respawn:

On Resurrect Attempt

🔗

Event

Patterns:
  • [on] [entity] resurrect[ion] [attempt]
Since: 2.2-dev28
Called when an entity dies, always. If they are not holding a totem, this is cancelled - you can, however, uncancel it.

Examples:

on resurrect attempt:
    entity is player
    entity has permission "admin.undying"
    uncancel the event

On Riptide

🔗

Event

Patterns:
  • [on] [use of] riptide [enchant[ment]]
Since: 2.5
Called when the player activates the riptide enchantment, using their trident to propel them through the air. Note: the riptide action is performed client side, so manipulating the player in this event may have undesired effects.

Examples:

on riptide:
    send "You are riptiding!"

On Script Load/Unload

🔗

Event

Patterns:
  • [on] [async] [script] (load|init|enable)
  • [on] [async] [script] (unload|stop|disable)
Since: 2.0
Called directly after the trigger is loaded, or directly before the whole script is unloaded. The keyword 'async' indicates the trigger can be ran asynchronously,

Examples:

on load:
    set {running::%script%} to true
on unload:
    set {running::%script%} to false

On Server List Ping

🔗

Event

Patterns:
  • [on] server [list] ping
Since: 2.3
Called when a server list ping is coming in, generally when a Minecraft client pings the server to show its information in the server list. The IP expression can be used to get the IP adress of the pinger. This event can be cancelled on PaperSpigot 1.12.2+ only and this means the player will see the server as offline (but still can join).

Also you can use MOTD, Max Players, Online Players Count, Protocol Version, Version String, Hover List and Server Icon expressions, and Player Info Visibility and Hide Player from Server List effects to modify the server list.

Examples:

on server list ping:
    set the motd to "Welcome %{player-by-IP::%ip%}%! Join now!" if {player-by-IP::%ip%} is set, else "Join now!"
    set the fake max players count to (online players count + 1)
    set the shown icon to a random server icon out of {server-icons::*}

On Server Start/Stop

🔗

Event

Patterns:
  • [on] (server|skript) (start|load|enable)
  • [on] (server|skript) (stop|unload|disable)
Since: 2.0
Called when the server starts or stops (actually, when Skript starts or stops, so a /reload will trigger these events as well).

Examples:

on skript start:
on server stop:

On Sheep Regrow Wool

🔗

Event

Patterns:
  • [on] sheep [re]grow[ing] wool
Since: 2.2-dev21
Called when sheep regrows its sheared wool back.

Examples:

on sheep grow wool:
    cancel event

On Shoot

🔗

Event

Patterns:
  • [on] [projectile] shoot
Since: 1.0
Called whenever a projectile is shot. Use the shooter expression to get who shot the projectile.

Examples:

on shoot:
    if projectile is an arrow:
        send "you shot an arrow!" to shooter

On Sign Change

🔗

Event

Patterns:
  • [on] sign (chang[e]|edit)[ing]
  • [on] [player] (chang[e]|edit)[ing] [a] sign
Since: 1.0
As signs are placed empty, this event is called when a player is done editing a sign.

Examples:

on sign change:
    line 2 is empty
    set line 1 to "<red>%line 1%"

On Slime Split

🔗

Event

Patterns:
  • [on] slime split[ting]
Since: 2.2-dev26
Called when a slime splits. Usually this happens when a big slime dies.

Examples:

on slime split:

On Smelt

🔗

Event

Patterns:
  • [on] [ore] smelt[ing]
  • [on] smelt[ing] of ore
Since: 1.0
Called when a furnace smelts an item in its ore slot.

Examples:

on smelt:

On Sneak Toggle

🔗

Event

Patterns:
  • [on] [player] toggl(e|ing) sneak
  • [on] [player] sneak toggl(e|ing)
Since: 1.0
Called when a player starts or stops sneaking. Use is sneaking to get whether the player was sneaking before the event was called.

Examples:

# make players that stop sneaking jump
on sneak toggle:
    player is sneaking
    push the player upwards at speed 0.5

On Spawn

🔗

Event

Patterns:
Since: 1.0, 2.5.1 (non-living entities)
Called when an entity spawns (excluding players).

Examples:

on spawn of a zombie:
on spawn of an ender dragon:
    broadcast "A dragon has been sighted in %world%!"

On Spawn Change

🔗

Event

Patterns:
  • [on] [world] spawn change
Since: 1.0
Called when the spawn point of a world changes.

Examples:

on spawn change:
    broadcast "someone changed the spawn!"

On Spectate

🔗

Event

Patterns:
Since: 2.7
Requirements: Paper
Called with a player starts, stops or swaps spectating an entity.

Examples:

on player start spectating of a zombie:

On Sponge Absorb

🔗

Event

Patterns:
  • [on] sponge absorb
Since: 2.5
Requirements: Minecraft 1.13 or newer
Called when a sponge absorbs blocks.

Examples:

on sponge absorb:
    loop absorbed blocks:
        broadcast "%loop-block% was absorbed by a sponge"!

On Spread

🔗

Event

Patterns:
  • [on] spread[ing]
Since: 1.0
Called when a new block forms as a result of a block that can spread, e.g. water or mushrooms.

Examples:

on spread:

On Sprint Toggle

🔗

Event

Patterns:
  • [on] [player] toggl(e|ing) sprint
  • [on] [player] sprint toggl(e|ing)
Since: 1.0
Called when a player starts or stops sprinting. Use is sprinting to get whether the player was sprinting before the event was called.

Examples:

on sprint toggle:
    player is not sprinting
    send "Run!"

On Swim Toggle

🔗

Event

Patterns:
  • [on] [entity] toggl(e|ing) swim
  • [on] [entity] swim toggl(e|ing)
Since: 2.3
Requirements: 1.13 or newer
Called when an entity swims or stops swimming.

Examples:

on swim toggle:
    event-entity does not have permission "swim"
    cancel event

On Tame

🔗

Event

Patterns:
  • [on] [entity] tam(e|ing)
Since: 1.0
Called when a player tames a wolf or ocelot. Can be cancelled to prevent the entity from being tamed.

Examples:

on tame:

On Target

🔗

Event

Patterns:
  • [on] [entity] target
  • [on] [entity] un[-]target
Since: 1.0
Called when a mob starts/stops following/attacking another entity, usually a player.

Examples:

on entity target:
    target is a player

On Teleport

🔗

Event

Patterns:
  • [on] [player] teleport[ing]
Since: 1.0
Called whenever a player is teleported, either by a nether/end portal or other means (e.g. by plugins).

Examples:

on teleport:

On Tool Change

🔗

Event

Patterns:
  • [on] [player['s]] (tool|item held|held item) chang(e|ing)
Since: 1.0
Called whenever a player changes their held item by selecting a different slot (e.g. the keys 1-9 or the mouse wheel), not by dropping or replacing the item in the current slot.

Examples:

on player's held item change:

On Vehicle Create

🔗

Event

Patterns:
  • [on] vehicle create
  • [on] creat(e|ing|ion of) [a] vehicle
Since: 1.0
Called when a new vehicle is created, e.g. when a player places a boat or minecart.

Examples:

on vehicle create:

On Vehicle Damage

🔗

Event

Patterns:
  • [on] vehicle damage
  • [on] damag(e|ing) [a] vehicle
Since: 1.0
Called when a vehicle gets damage. Too much damage will destroy the vehicle.

Examples:

on vehicle damage:

On Vehicle Destroy

🔗

Event

Patterns:
  • [on] vehicle destroy
  • [on] destr(oy[ing]|uction of) [a] vehicle
Since: 1.0
Called when a vehicle is destroyed. Any passenger will be ejected and the vehicle might drop some item(s).

Examples:

on vehicle destroy:
    cancel event

On Vehicle Enter

🔗

Event

Patterns:
  • [on] vehicle enter
  • [on] enter[ing] [a] vehicle
Since: 1.0
Called when an entity enters a vehicle, either deliberately (players) or by falling into them (mobs).

Examples:

on vehicle enter:
    entity is a player
    cancel event

On Vehicle Exit

🔗

Event

Patterns:
  • [on] vehicle exit
  • [on] exit[ing] [a] vehicle
Since: 1.0
Called when an entity exits a vehicle.

Examples:

on vehicle exit:
    if event-entity is a spider:
        kill event-entity

On Weather Change

🔗

Event

Patterns:
Since: 1.0
Called when a world's weather changes.

Examples:

on weather change:
on weather change to sunny:

On World Init

🔗

Event

Patterns:
  • [on] world init[ialization]
Since: 1.0
Called when a world is initialised. As all default worlds are initialised before any scripts are loaded, this event is only called for newly created worlds. World management plugins might change the behaviour of this event though.

Examples:

on world init:

On World Load

🔗

Event

Patterns:
  • [on] world load[ing]
Since: 1.0
Called when a world is loaded. As with the world init event, this event will not be called for the server's default world(s).

Examples:

on world load:
    send "World is loading..." to console

On World Save

🔗

Event

Patterns:
  • [on] world sav(e|ing)
Since: 1.0
Called when a world is saved to disk. Usually all worlds are saved simultaneously, but world management plugins could change this.

Examples:

on world saving:
    broadcast "World has been saved!"

On World Unload

🔗

Event

Patterns:
  • [on] world unload[ing]
Since: 1.0
Called when a world is unloaded. This event might never be called if you don't have a world management plugin.

Examples:

on world unload:
    cancel event

On Zombie Break Door

🔗

Event

Patterns:
  • [on] zombie break[ing] [a] [wood[en]] door
Since: 1.0
Called when a zombie is done breaking a wooden door. Can be cancelled to prevent the zombie from breaking the door.

Examples:

on zombie breaking a wood door:

Periodical

🔗

Event

Patterns:
Since: 1.0
An event that is called periodically.

Examples:

every 2 seconds:
every minecraft hour:
every tick: # can cause lag depending on the code inside the event
every minecraft days:

Periodical

🔗

Event

Patterns:
Since: 1.0
An event that is called periodically.

Examples:

every 2 seconds in "world":
every minecraft hour in "flatworld":
every tick in "world": # can cause lag depending on the code inside the event
every minecraft days in "plots":