%event.entity% · entity damage, entity death, mob spawn · The entity type, e.g. zombie
on entity damage:
if event.cause is "FALL":
if player has permission "hyperscript.nofall":
cancel event
send action bar "&aFall damage negated!" to victim
Each event makes its details available inside its block. Every value has a placeholder, and the common ones also have a one-word short form.
on entity damage:
if event.cause is "FALL":
if player has permission "hyperscript.nofall":
cancel event
send action bar "&aFall damage negated!" to victim
on player chat:
if message contains "badword":
cancel event
send "&cPlease keep chat friendly!" to player
Short form
Placeholder
Events
Meaning
attacker
%event.attacker%
entity damage
Who dealt the damage: a player's name or a mob type; for a projectile, whoever shot it; unset if nobody did
victim
%event.victim%
entity damage
Who was hurt: a player's name or a mob type
damage
%event.damage%
entity damage
Damage taken after armour; 2 is one heart
cause
%event.cause%
entity damage
FALL, FIRE, ENTITY_ATTACK, PROJECTILE and so on
cause
%event.cause%
player death
What killed the player, in the same words
message
%event.message%
player chat
The chat message
message
%event.message%
player death
The death message everyone will see
message
%event.message%
player command
The whole line as typed, e.g. /home set base
command
%event.command%
player command
The command without the slash, in lower case: home
amount
%event.amount%
item pickup, item drop
How many items are in the stack
%event.gamemode%
gamemode change
The mode being changed to
%event.effect%
effect gained, effect ended
The potion effect
%event.advancement%
advancement
The advancement's id
%event.weather%
weather change
rain or clear
%event.inventory%
inventory open, inventory close
The kind of container
%event.region%
region enter, region leave
The name of the region
%event.opponent%
combat start
The name of the other player; unset when a script started the fight
%event.streak%
kill streak
How many players they have killed in a row since they last died
%event.word%
blocked word
The blocked word that was found in what the player wrote
%event.lines%
sign change
A list of the sign's lines, top to bottom
%event.clicked%
entity click
A player's name if a player was clicked, otherwise the entity type
%event.level%, %event.old_level%
level up
The level reached, and the one before
%event.name%
player login
The name of whoever is logging in
%event.uuid%
player login
Their account id
%event.address%
player login, server ping
The address they are connecting from
%event.from%
world change
The name of the world the player left
block
%event.block%
block break, right click
The block type, e.g. diamond_ore
%event.power%
redstone
The power the block has now, 0 to 15
entity
%event.entity%
entity damage, entity death, mob spawn
The entity type, e.g. zombie
killer
%event.killer%
entity death, player death
Name of the player who made the kill
reason
%event.reason%
mob spawn
NATURAL, SPAWNER, SPAWNER_EGG, BREEDING, CUSTOM and so on
slot
%event.slot%
inventory click
The slot clicked, counting from 1 like the slots of open gui
item
%event.item%
inventory click, right click, item pickup, item drop
The item type clicked, held, picked up or dropped
%event.click_type%
inventory click
LEFT, RIGHT, SHIFT_LEFT, MIDDLE, DROP and so on
%event.recipients%
player chat
A list of the names of the players who will see the message
%event.drops%
block break, entity death
A list of the items that are about to drop
%event.location%
block break, right click, entity damage, mob spawn, player jump
Where it happened, as a location; also written event's location
A value that does not apply to the current event is unset.
Comparisons ignore case, so cause is "fall" and cause is "FALL" are the same.
item on its own is the event's item. Followed by a number it is still the list lookup item 2 of <list>.
player in on entity damage is the player who was hurt, or, if the victim is not a player, the player who dealt the damage. victim and attacker are always exact.
on player death can rewrite or remove the message everyone sees: set death message to "&c%player.name% fell over" and hide death message. on entity death fires for players too, with player being the killer; on player death is the one where player is who died.
on player command sees every command before the server does, including ones that do not exist. cancel event stops the command from running, which makes it the way to block commands:
on player command:
if command is "plugins" and player does not have permission "server.admin":
cancel event
send "&cThat command is not available."
on region enter and on region leave fire when a player crosses the edge of a region made with create region, on foot or by teleport. Movement is only watched while a loaded script has one of these blocks, and only when a player steps into a different block. Neither can be cancelled; to keep someone out, teleport them back.
block, item, entity and cause also work in the newer events: the block placed, the item crafted, eaten or caught, the entity clicked, and why a teleport is happening.
on entity damage and on mob spawn fire extremely often. Put the cheapest test first, as the example does, so that most runs end after one line.
on player jump works on Spigot and Paper. Cancelling it snaps the player back to where they were; because the jump has already started on their screen, a small hop may be visible.
on inventory click fires for every inventory, including the player's own and GUIs opened by scripts. Cancelling it means the click moves nothing.
The Docs page of the documentation site lists every event with its values, whether it can be cancelled, a working example, and a box for trying the values out. The same information is published for other tools as events_metadata.json.