// Hand-written examples for Docs entries that no example elsewhere in the documentation covers.
// An entry starts with '@ ' followed by the entry's syntax exactly as the Docs page shows it.
// Every example here is compiled when the documentation is checked, so it has to be real code.

@ %server.max_players%
send "&7%server.online_players% of %server.max_players% players online"

@ %server.time%
set {%player%.last_seen} to server.time

@ %event.world%, %event.x%, %event.y%, %event.z%
on block break:
    log "%player.name% broke a block at %event.x%, %event.y%, %event.z% in %event.world%"

@ %discord.user%
on discord command "/hello":
    reply "Hello, %discord.user%!"

@ %discord.channel%
on discord command "/where":
    reply "You are in #%discord.channel%"

@ <amount> in front
give 16 bread to player

@ ( )
set {_total} to ({_price} + {_tax}) * {_amount}

@ random integer between A and B
set {_roll} to random integer between 1 and 6

@ random number between A and B
set {_chance} to random number between 0 and 1

@ > < >= <=
if {%player%.coins} >= 100:
    send "&aYou can afford it."

@ is a number / is not a number
if arg.1 is not a number:
    send "&cUsage: /pay <amount>"
    stop

@ {_list.<n>}
set {_parts} to split "Coins:500" by ":"
send "You have %{_parts.2}% coins"

@ remove <value> from <variable>
remove player.name from {winners}

@ join <list> with <separator>
send "Online: " + join server.players with ", "

@ trimmed <text>
set {_name} to trimmed args

@ replace <a> with <b> in <text>
set {_pretty} to replace "_" with " " in "diamond_sword"

@ last <n> characters of <text>
set {_ending} to last 3 characters of player.name

@ characters <a> to <b> of <text>
set {_middle} to characters 2 to 4 of "Hello"

@ length of <text>
if length of args > 50:
    send "&cThat is too long."

@ rounded <number>
send "TPS: " + rounded server.tps

@ append <text> to file at <path>
append "\n%player.name% joined" to file at "plugins/HyperScript/log.txt"

@ delete file at <path>
delete file at "plugins/HyperScript/notes/old.txt"

@ execute player command <text>
execute player command "spawn"

@ give <who> <item> or give <item> to <who>
give player 3 diamond
give 16 bread to player

@ attacker
on entity damage:
    if attacker is set and victim is "villager":
        cancel event

@ %event.click_type%
on inventory click:
    if event.click_type is "SHIFT_LEFT":
        cancel event

@ %event.recipients%
on player chat:
    log "%player.name% wrote to: %event.recipients%"

@ %event.location%
on block break:
    spawn particle "flame" at event's location

@ permission: value
command /fly:
    permission: "server.fly"
    trigger:
        execute console command "fly %player.name%"

@ permission <who> remove <node>
permission player remove "server.fly"

@ delete line <n> of <who>'s scoreboard
delete line 3 of player's scoreboard

@ headers <text>, <text>, ...
async:
    send post request to "https://api.example.com/v1/events" with body "{\"type\":\"join\"}" headers "Authorization: Bearer abc123"

@ hide player count
on server ping:
    hide player count

@ set server icon to <path>
on server ping:
    set server icon to "plugins/HyperScript/icon.png"

@ set quit message to <text>
on player quit:
    set quit message to "&c- &f%player.name%"

@ hide join message / hide quit message
on player join:
    hide join message

@ set chat message to <text>
on player chat:
    if message contains "badword":
        set chat message to "(removed)"

// ---- Entries where the automatic match picked a line that shows something else ----

@ /
set {_average} to {%player%.total} / {%player%.games}

@ %
if {%player%.blocks} % 50 == 0:
    send "&bAnother 50 blocks mined!"

@ -
set {_left} to {%player%.coins} - 50

@ *
set {_double} to {%player%.coins} * 2

@ and, or, not
if {%player%.coins} >= 50 and not {shop_closed}:
    send "&aThe shop is open."

@ is / is not
if event.cause is "FALL":
    cancel event

@ <list> + <value>
set {_everyone} to server.players + "Console"

@ <text> + <text>
set {_greeting} to "Hello, " + player.name

@ send <text> to <player name>
send "&e%player.name% says hi!" to arg.1

@ wait <number> seconds
set {_delay} to 5
wait {_delay} seconds

@ file at <path> exists
if file at "plugins/HyperScript/notes.txt" exists:
    send read file at "plugins/HyperScript/notes.txt"

@ damage
on entity damage:
    if damage >= 10:
        send "&cThat hit hard!" to victim

@ block
on block break:
    if block is "diamond_ore":
        broadcast "&b%player.name% found diamonds!"

@ slot
on inventory click:
    if slot is 1:
        send "&7You clicked the first slot."

@ item
on right click:
    if item is "compass":
        send "&bYou are in %player.world%"

@ permission <who> add <node> / permission <who> remove <node>
permission player add "server.fly"
permission player remove "server.fly"

@ permission <who> add <node>
permission player add "server.fly"

@ sorted <list>
set {_names} to sorted server.players

@ reversed <list>
set {_newest_first} to reversed {winners}

@ x of <location>, y of <location>, z of <location>
set {_height} to y of player's location

@ world of <location>
send "Your home is in " + world of {%player%.home}

@ set y of <variable> to <number>
set {_loc} to player's location
add 10 to y of {_loc}
teleport player to {_loc}

@ block at <position>
if block at player's location is "water":
    send "&bYou are standing in water."

@ send <text> to player
send "&aSaved." to player

@ send <text> to all players
send "&6The event starts in one minute!" to all players

@ remove <item> from <who>
if player has 5 diamond:
    remove 5 diamond from player

@ has <item>
if player has 5 diamond:
    send "&aYou can afford the upgrade."

@ does not have <item>
if player does not have 1 iron pickaxe:
    send "&cBring a pickaxe."

@ parse <text> as number
set {_amount} to parse arg.1 as number
if {_amount} is not set:
    send "&cThat is not a number."

@ parse <text> as integer
set {_whole} to parse "7.9" as integer

@ parse <value> as text
set {_label} to parse 52 as text

@ return [<value>]
function double({_n}):
    return {_n} * 2

@ function <name>(<locals>):
function reward({_who}, {_amount}):
    add {_amount} to {%{_who}%.coins}
    return {%{_who}%.coins}

@ local function <name>(<locals>):
local function prefix():
    return "&7[&bShop&7] "

@ command
on player command:
    if command is "plugins":
        cancel event

@ amount
on item pickup:
    send "&7Picked up %event.amount% %event.item%"

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

@ %hyperscript_<name>%
set {event_active} to true
# Any plugin that uses PlaceholderAPI can now show it:
# "Event running: %hyperscript_event_active%"

@ %hyperscript_player_<name>%
set {%player%.coins} to 100
# Any plugin that uses PlaceholderAPI can now show it to that player:
# "Coins: %hyperscript_player_coins%"

@ min(a, b, ...) / max(a, b, ...)
set {_level} to max(1, {%player%.level})
set {_cheapest} to min([30, 12, 45])

@ abs(n)
set {_apart} to abs(player.y - 64)

@ round(n)
set {_whole} to round(2.5)

@ floor(n) / ceil(n)
set {_pages} to ceil(size of {warps} / 9)

@ rounded up <n> / rounded down <n>
set {_minutes} to rounded up ({_seconds} / 60)

@ sqrt(n)
set {_side} to sqrt(25)

@ duration(seconds)
set {_left} to duration({%player%.ready} - server.time)
send "&cWait %{_left}%."

@ duration(<seconds>)
send "&7Uptime: " + duration(125)

@ distance between <a> and <b>
if distance between player's location and {spawn} > 100:
    send "&7You are far from spawn."

@ is banned / is not banned
if arg.1 is banned:
    send "&c%arg.1% is banned."

@ items <a> to <b> of <list>
set {_top} to items 1 to 5 of reversed sorted {scores}

@ index of <value> in <list>
set {_place} to index of player.name in {queue}

@ random item of <list>
send random item of ["Hello!", "Hi there!", "Welcome!"]

@ keys of {<table>}
for each {_name} in keys of {warp}:
    send "&7 - &b%{_name}%"

@ break / continue
for each {_name} in {queue}:
    if {_name} is "Steve":
        continue
    send "&7Next: %{_name}%"
    break

@ send <text> with click command <text>
send "&a[Go home]" with click command "/home"

@ send <text> with hover <text>
send "&e[?]" with hover "&7Hover text can explain things."

@ with click command <text>
send "&a[Accept]" with click command "/accept"

@ with click suggestion <text>
send "&7[Reply]" with click suggestion "/msg Alex "

@ with click url <text>
send "&b[Website]" with click url "https://example.com"

@ with hover <text>
send "&6Rules" with hover "&7Be kind.\n&7No griefing."

@ set helmet of <who> to <item>
set helmet of player to 1 diamond helmet enchanted with protection 4

@ clear inventory of <who>
clear inventory of player

@ helmet, chestplate, leggings, boots
set chestplate of player to 1 iron chestplate
delete boots of player

@ tool
if tool of player is not set:
    send "&7Your hand is empty."

@ offhand
set offhand of player to 1 shield

@ inventory slot <n>
set inventory slot 1 of player to 1 compass named "&bMenu"

@ kick, ban, unban
kick arg.1 because "&cPlease calm down."
ban arg.1 for 7 days because "&cGriefing"

@ kick <who> [because <text>]
kick arg.1 because "&cPlease calm down."

@ ban <who> [for <duration>] [because <text>]
ban arg.1 for 7 days because "&cGriefing"

@ unban <who>
unban arg.1

@ <who> is banned / is not banned
if arg.1 is not banned:
    send "&7%arg.1% is not banned."

@ refuse login [because <text>]
on player login:
    if {maintenance}:
        refuse login because "&eBack soon!"

@ add <who> to team <name>
add player to team "red"

@ remove <who> from team
remove player from team

@ remove <who> from team <name>
remove player from team "red"

@ set color of team <name> to <colour>
set color of team "red" to red

@ set prefix of team <name> to <text> / set suffix of team <name> to <text>
set prefix of team "red" to "&c[Red] "

@ set friendly fire of team <name> to <true or false>
set friendly fire of team "red" to false

@ delete team <name>
delete team "red"

@ team of <who>
if team of player is "red":
    send "&cGo red!"

@ players of team <name>
for each {_mate} in players of team "red":
    send "&cRed team, assemble!" to {_mate}

@ <on|off>, <red|blue|green>
command /event <on|off>:
    trigger:
        send "&7You chose %arg.1%."

@ <player> or <target>
command /greet <player>:
    trigger:
        send "&aHello from %player.name%!" to arg.1

@ %event.name%
on player login:
    log "%event.name% is connecting from %event.address%"

@ %event.uuid%
on player login:
    log "%event.name% has the id %event.uuid%"


@ %event.address%
on player login:
    log "%event.name% is connecting from %event.address%"

@ heal <who> / feed <who>
heal player
feed player

@ health of <who>
if health of player < 6:
    send "&cYou are badly hurt!"

@ max health of <who>
set max health of player to 40

@ food of <who>
set food of player to 20

@ level of <who>
add 5 to level of player

@ gamemode of <who>
set gamemode of player to creative

@ flight of <who>
set flight of player to true

@ apply <effect> [<level>] to <who> [for <duration>]
apply speed 2 to player for 30 seconds

@ clear effects of <who> / clear <effect> effect of <who>
clear effects of player
clear speed effect of player

@ ignite <who> [for <duration>] / extinguish <who>
ignite arg.1 for 3 seconds
extinguish player

@ freeze <who> / unfreeze <who>
freeze arg.1
send "&cYou have been frozen." to arg.1

@ vanish <who> / unvanish <who>
vanish player
send "&7Nobody can see you now."

@ <who> has effect <effect> / does not have effect <effect>
if player has effect speed:
    send "&bYou are fast."

@ has effect / does not have effect
if player does not have effect night vision:
    apply night vision to player for 5 minutes

@ <who> is frozen / is vanished / is flying
if arg.1 is frozen:
    send "&7%arg.1% is frozen."

@ is frozen / is vanished / is flying
if player is flying:
    send "&7Enjoy the view."

@ is tagged / is not tagged
if tool of player is tagged "wand":
    send "&dThe wand hums."

@ heal, feed, apply <effect>, freeze, vanish
heal player
apply regeneration 2 to player for 10 seconds

@ top <n> players by {<name>}
set {_place} to 0
for each {_name} in top 10 players by {coins}:
    add 1 to {_place}
    send "&e#%{_place}% &f%{_name}%"

@ rank of <who> by {<name>}
set {_mine} to rank of player by {coins}
send "&7You are #%{_mine}%"

@ gui page
open gui with title "&8Menu" with 1 rows for player:
    slot 5 is "paper" named "&fPage %gui page%"

@ page <n> of <list> with <k> per page
set {_shown} to page 2 of {names} with 9 per page

@ pages of <list> with <k> per page
set {_count} to pages of {names} with 9 per page

@ next page / previous page
open gui with title "&8Menu" with 1 rows for player:
    slot 1 is "arrow" named "&ePrevious":
        previous page
    slot 9 is "arrow" named "&eNext":
        next page

@ set gui page to <n>
open gui with title "&8Menu" with 1 rows for player:
    slot 5 is "compass" named "&eBack to the first page":
        set gui page to 1

@ refresh gui
open gui with title "&8Clicker" with 1 rows for player:
    slot 5 is "gold_ingot" named "&6Clicks: %{%player%.clicks}%":
        add 1 to {%player%.clicks}
        refresh gui

@ every day at <hh:mm>:
every day at 18:00:
    broadcast "&6The evening event starts now!"

@ every monday at <hh:mm>:
every monday at 00:00:
    delete {weekly_winner}

@ %event.region%
on region enter:
    send action bar "&7Entering &f%event.region%" to player

@ %event.lines%
on sign change:
    log "%player.name% wrote: %event.lines%"

@ %event.clicked%
on entity click:
    send "&7You clicked &f%event.clicked%"

@ %event.level%, %event.old_level%
on level up:
    send "&aLevel %event.old_level% -> %event.level%"

@ starts with / ends with
on player chat:
    if message starts with "!":
        cancel event
        send "&7Commands start with / here."

@ matches
if not (arg.1 matches "[a-zA-Z0-9_]{3,16}"):
    send "&cThat is not a valid name."

@ chance of <n>%
on block break:
    if chance of 5%:
        give 1 diamond to player
        send "&bLucky find!"

@ random player
set {_winner} to random player
broadcast "&6%{_winner}% wins the draw!"

@ shuffled <list>
set {_order} to shuffled server.players

@ unique <list>
set {_once} to unique ["a", "b", "a"]

@ sum of <list> / average of <list>
set {_total} to sum of [10, 20, 30]
set {_mean} to average of [10, 20, 30]

@ players within <n> blocks of <location>
for each {_near} in players within 10 blocks of player:
    send "&7%player.name% waves at you." to {_near}

@ <text> parsed as number
set {_amount} to arg.1 parsed as number
if {_amount} is not set:
    send "&cThat is not a number."

@ now formatted as <pattern>
send "&7It is " + now formatted as "HH:mm"

@ %server.date%
log "Backup finished on %server.date% at %server.clock%"

@ %server.clock%
send "&7Server time: &f%server.clock%"

@ %server.weekday%
if server.weekday is "saturday":
    send "&6Double coins today!"

@ %server.hour%, %server.minute%
if server.hour >= 22:
    send "&7It is late. Good night!"

@ options:
options:
    prefix: "&8[&6Shop&8] "
command /shop:
    trigger:
        send "{@prefix}&7Welcome."

@ command /name:
command /hello:
    trigger:
        send "&aHello!"

@ on <event>:
on player join:
    send "&aWelcome!"

@ on load:
on load:
    if {motd} is not set:
        set {motd} to "&aWelcome!"

@ every <time>:
every 5 minutes:
    broadcast "&7Remember to vote!"

@ function name():
function greet():
    send "&aHello!"

@ # Requires: 1.5.9
# Requires: 1.5.9
on player join:
    send "&aWelcome!"

@ # Tags: chat, welcome
# Tags: chat, welcome
on player join:
    send "&aWelcome!"

@ on server start:
on server start:
    log "The server is up. %server.online_players% player(s) online."

@ on server stop:
on server stop:
    set {last_shutdown} to now

@ %server.worlds%
for each {_world} in server.worlds:
    send "&7 - &f%{_world}%"

@ %server.operators%, %server.banned%, %server.whitelist%
send "&7Operators: &f%server.operators%"

@ %server.plugins%
send "&7Plugins: &f%server.plugins%"

@ %server.uptime%
send "&7The server has been up for &f%server.uptime%"

@ %server.memory_used%, %server.memory_max%
send "&7Memory: &f%server.memory_used% &7of &f%server.memory_max% &7MB"

@ pow(a, b)
set {_cost} to 100 * pow(2, {%player%.upgrades})

@ round(n, places)
set {_ratio} to round({%player%.kills} / max(1, {%player%.deaths}), 2)

@ percent(part, whole)
set {_done} to percent({%player%.quests_done}, 20)
send "&7Quests: &f%{_done}%%"

@ commas(n)
set {_shown} to commas({%player%.coins})
send "&6Balance: &e%{_shown}% coins"

@ ordinal(n)
set {_place} to ordinal(rank of player by {coins})
send "&7You are in &f%{_place}% &7place."

@ roman(n)
set {_level} to roman({%player%.prestige})
send "&dPrestige %{_level}%"

@ today / tomorrow
if {%player%.last_vote} < today:
    send "&eYou have not voted today."

@ time since <date>
set {_ago} to time since {%player%.last_death}
send "&7You last died %{_ago}% ago."

@ first join date of <who> / last seen of <who>
set {_seen} to last seen of arg.1
send "&7%arg.1% was last on: &f%{_seen}%"

@ is between <a> and <b>
if player.y is between 0 and 16:
    send "&bDiamond level!"

@ is in <list>
if arg.1 is in ["on", "off"]:
    send "&aOK."

@ is empty
if {queue} is empty:
    send "&7Nobody is waiting."

@ is a list / a location / an item / a date / an entity / a table / text
if {%player%.home} is a location:
    teleport player to {%player%.home}

@ is a player
if arg.1 is not a player:
    send "&c%arg.1% is not online."

@ is alphanumeric
if arg.1 is not alphanumeric:
    send "&cUse letters and digits only."

@ is sneaking / sprinting / swimming / blocking / sleeping / on ground / in water
on right click:
    if player is sneaking:
        send "&7A sneaky click."

@ is op / is online
if arg.1 is online:
    send "&a%arg.1% is here."

@ has played before
if arg.1 has played before:
    send "&7%arg.1% has been here."

@ is holding <item> / is wearing <item>
if player is holding diamond sword:
    send "&bNice sword."

@ can see <player>
if player can see arg.1:
    send "&7You can see %arg.1%."

@ <world> is raining / is day / is night
if player.world is night:
    send "&7It is dark. Watch out."

@ <block> is solid
if block at (location below player's location) is solid:
    send "&7You are on firm ground."

@ numbers from <a> to <b>
for each {_n} in numbers from 3 to 1:
    send "&e%{_n}%..."

@ count of <value> in <list>
set {_votes} to count of "yes" in {votes}

@ min of <list> / max of <list>
set {_best} to max of {scores}

@ capitalized <text>
send capitalized "hello there"

@ title case <text>
set {_nice} to title case "diamond_sword"
send "&7You found a %{_nice}%"

@ uncoloured <text>
log uncoloured "&aGreen text"

@ word <n> of <text>
set {_first} to word 1 of args

@ <text> repeated <n> times
send "&8" + ("-" repeated 20 times)

@ run <function>(...) in <duration>
function remind({_who}):
    send "&eTime is up!" to {_who}
command /timer:
    trigger:
        run remind(player.name) in 30 seconds

@ console only: true
command /maintenance:
    console only: true
    trigger:
        set {maintenance} to true

@ <name:player>
command /greet <target:player>:
    trigger:
        send "&aHello!" to arg.1

@ <name:number>
command /setprice <price:number>:
    trigger:
        set {price} to arg.1

@ <name:integer>
command /roll <sides:integer>:
    trigger:
        send "&7You rolled " + random integer between 1 and arg.1

@ [name:type]
command /heal [target:player]:
    trigger:
        if arg.1 is set:
            heal arg.1
        else:
            heal player

@ strike lightning at <location>
strike lightning at player's location

@ create explosion at <location> [with power <n>]
create explosion at player's location with power 3 without breaking blocks

@ fill from <location> to <location> with <block>
fill from 0, 64, 0 in "world" to 4, 64, 4 in "world" with stone

@ break block at <location>
break block at location below player's location

@ grow tree at <location>
grow tree at player's location

@ drop <item> at <location>
drop 1 diamond at event's location

@ set spawn of world <name> to <location>
set spawn of world "world" to player's location

@ set world border of world <name> to <size> [over <duration>]
set world border of world "world" to 500 over 5 minutes

@ make <who> say <text>
make player say "I love this server!"

@ open workbench for <who> / open enderchest for <who>
open workbench for player

@ fly speed of <who> / walk speed of <who>
set walk speed of player to 0.4

@ saturation of <who> / air of <who>
if air of player < 3:
    send "&cYou are running out of breath!"

@ held slot of <who>
set held slot of player to 1

@ compass target of <who>
set compass target of player to {spawn}

@ bed location of <who>
command /bed:
    players only: true
    trigger:
        if bed location of player is not set:
            send "&7You have not slept in a bed yet."
            stop
        teleport player to bed location of player

@ yaw of <who> / pitch of <who> / direction of <who>
send "&7You are facing &f" + direction of player

@ ip of <who> / locale of <who>
log "%player.name% uses the language " + locale of player

@ time played of <who>
send "&7Played: &f" + time played of player

@ fall distance of <who>
if fall distance of player > 20:
    send "&cBrace yourself!"

@ event entity
on mob spawn:
    set {_mob} to event entity
    set name of {_mob} to "&cWild thing"

@ clicked entity
on entity click:
    push clicked entity upward with force 0.6

@ target entity of <who>
set {_looking} to target entity of player
if {_looking} is set:
    send "&7You are looking at &f%{_looking}%"

@ push <who> upward / downward / forward / backward [with force <n>]
push player upward with force 1.2

@ push <who> towards <location> [with force <n>]
push player towards {spawn} with force 0.8

@ remove entity <entity>
summon zombie at player's location
set {_mob} to last summoned entity
wait 10 seconds
remove entity {_mob}

@ remove all <type> within <n> blocks of <location>
remove all zombies within 20 blocks of player's location

@ <location> offset by <x>, <y>, <z>
teleport player to player's location offset by 0, 10, 0

@ location above <location> / location below <location>
set block at location below player's location to stone

@ midpoint between <a> and <b>
set {_middle} to midpoint between {arena.corner1} and {arena.corner2}

@ highest block at <location>
teleport player to location above highest block at player's location

@ biome at <location>
send "&7Biome: &f" + biome at player's location

@ light level at <location>
if light level at player's location < 8:
    send "&7Mobs can spawn here."

@ target block of <who>
set {_looked} to target block of player
if {_looked} is set:
    strike fake lightning at {_looked}

@ <location> is within <n> blocks of <location>
if player's location is within 10 blocks of {spawn}:
    send "&aYou are near spawn."

@ <location> is loaded
if {arena} is loaded:
    summon zombie at {arena}


@ players only: true
command /sethome:
    players only: true
    trigger:
        set {%player%.home} to player's location

@ increase <variable> by <n> / decrease <variable> by <n>
increase {%player%.coins} by 10
decrease {%player%.lives} by 1

@ toggle <variable>
toggle {%player%.pvp_on}
send "&7PvP: %{%player%.pvp_on}%"

@ swap <variable> and <variable>
swap {team.red.score} and {team.blue.score}

@ default <variable> to <value>
on load:
    default {motd} to "&aWelcome!"

@ has space for <item>
if player has space for 5 diamond:
    give 5 diamond to player
else:
    send "&cYour inventory is full."

@ is bedrock / is dead
if player is bedrock:
    send "&7Bedrock players: use /menu instead of the book."

@ <a> if <condition> else <b>
set {_state} to "&aon" if {%player%.pvp_on} else "&coff"
send "&7PvP is %{_state}%"

@ <list> without <value>
for each {_other} in server.players without player.name:
    send "&7%player.name% says hi" to {_other}

@ <list> sorted by {<name>}
set {_richest} to server.players sorted by {coins}
send "&6Richest online: &e" + item 1 of {_richest}

@ map each <list> to <expression>
set {_shouted} to map each ["red", "blue"] to uppercase it

@ <text> padded to <n>
for each {_name} in server.players:
    send "&f" + ({_name} padded to 16) + "&e%{%{_name}%.coins}%"

@ clamp(n, least, most)
set {%player%.mana} to clamp({%player%.mana} + 5, 0, 100)

@ random(a, b)
set {_roll} to random(1, 6)
send "&7You rolled a &f%{_roll}%"

@ run <function>(...) in <duration> as <name>
function end_boost({_who}):
    set walk speed of {_who} to 0.2
command /boost:
    trigger:
        set walk speed of player to 0.4
        run end_boost(player.name) in 30 seconds as "boost %player.name%"

@ cancel run <name>
cancel run "boost %player.name%"

@ respawn <who>
on player death:
    wait 1 tick
    respawn player

@ show <who> a book titled <text> with pages <text>, <text>
show player a book titled "Rules" with pages "&lRules\n\n1. Be kind.", "2. No griefing."

@ hide <who> from <who> / show <who> to <who>
hide player from arg.1
send "&7%arg.1% can no longer see you."

@ clear title of <who>
clear title of player

@ tab name of <who>
set tab name of player to "&6[VIP] &f%player.name%"

@ free slots of <who>
if free slots of player < 3:
    send "&eYour inventory is nearly full."

@ ping of <who>
send "&7Ping of %arg.1%: &f" + ping of arg.1

@ spawn firework at <location>
spawn firework at player's location colored red, yellow shaped star with power 1

@ play effect <name> at <location>
play effect ender_signal at player's location

@ set line <n> of sign at <location> to <text>
set line 1 of sign at {shop.sign} to "&a[Open]"

@ items in chest at <location>
for each {_item} in items in chest at {reward.chest}:
    give {_item} to player

@ add <item> to chest at <location> / clear chest at <location>
clear chest at {reward.chest}
add 3 diamond to chest at {reward.chest}

@ set gamerule <name> of world <name> to <value>
set gamerule keepInventory of world "world" to true

@ set difficulty of world <name> to <level>
set difficulty of world "world" to hard

@ set pvp of world <name> to <true or false>
set pvp of world "world" to false

@ set pvp of region <name> to <true or false>
on load:
    set pvp of region "spawn" to false

@ set build of region <name> to <true or false>
on load:
    set build of region "spawn" to false

@ players in region <name>
for each {_name} in players in region "arena":
    send "&cThe match starts now!" to {_name}

@ spawn of world <name>
teleport player to spawn of world "world"

@ tab complete: <list>
command /warp <name>:
    tab complete: keys of {warp}
    trigger:
        teleport player to {warp.%arg.1%}

@ disabled: true
command /beta:
    disabled: true
    trigger:
        send "&7Not ready yet."

@ subcommand <name>:
command /team:
    subcommand join <red|blue>:
        trigger:
            add player to team arg.1
    subcommand leave:
        trigger:
            remove player from team

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

@ type of <item>
set {_held} to tool of player
if type of {_held} is "diamond_sword":
    send "&bA fine blade."

@ amount of <item>
set {_held} to tool of player
send "&7You are holding " + amount of {_held} + " item(s)."

@ send toast <text> [with icon <item>] [as goal] [to <who>]
send toast "&aQuest complete!" with icon diamond as challenge to player

@ give head of <name> to <who>
on player kill:
    give head of victim to player

@ set item cooldown of <item> for <who> to <duration>
on right click:
    if event.item is "blaze_rod":
        if item cooldown of blaze rod for player > 0 seconds:
            stop
        set item cooldown of blaze rod for player to 5 seconds
        strike lightning at target block of player

@ stop sound <name> [for <who>] / stop all sounds [for <who>]
stop sound "music_disc.cat" for player

@ absorption of <who>
set absorption of player to 8

@ protocol version of <who>
if protocol version of player < 765:
    send "&eYou are on an old version; some things may look different."

@ client brand of <who>
log "%player.name% plays with " + client brand of player

@ create hologram <name> at <location> with lines <text>, <text>
command /sethologram:
    permission: "holograms.manage"
    trigger:
        create hologram "welcome" at player's location with lines "&6&lWelcome", "&7Type &f/help &7to begin"

@ set line <n> of hologram <name> to <text>
every 1 minute:
    set line 2 of hologram "welcome" to "&7Online: &f%server.online_players%"

@ delete hologram <name>
delete hologram "welcome"

@ holograms
send "&7Holograms: &f" + join holograms with ", "

@ set item <n> of <variable> to <value>
set {podium} to ["Steve", "Alex", "Bob"]
set item 1 of {podium} to player.name
send "&6First place: &f" + item 1 of {podium}

@ ask <who> <text> into <variable>
command /clan <action>:
    trigger:
        ask player "&eWhat should your clan be called?" into {_name} for at most 30 seconds
        if {_name} is not set:
            send "&cToo slow."
            stop
        send "&aClan %{_name}% created."

@ ask <who> <text> with options <text>, <text> into <variable>
ask player "&ePick a team:" with options "Red", "Blue" into {_team}
if {_team} is set:
    add player to team lowercase {_team}

@ confirm <text>:
command /delhome:
    trigger:
        confirm "&cDelete your home? This cannot be undone.":
            delete {%player%.home}
            send "&eHome deleted."

@ items in ender chest of <who>
send "&7Your ender chest holds " + size of (items in ender chest of player) + " stack(s)."

@ add <item> to ender chest of <who> / clear ender chest of <who>
add 3 diamond to ender chest of player
send "&bA gift is waiting in your ender chest."

@ format(n, pattern)
set {_ratio} to {%player%.kills} / max({%player%.deaths}, 1)
send "&7K/D: &f" + format({_ratio}, "0.00")

@ json of <value>
set {_body.player} to player.name
set {_body.coins} to {%player%.coins} + 0
send post request to "https://example.com/hook" with body json of {_body}

@ owned by <name>
give 1 player head owned by "Notch" named "&6Notch's head" to player

@ with potion <kind>
give 1 splash potion with potion strong_healing to player

@ with segments <n>
create bossbar "lives" titled "&cLives" with color red with segments 10 with progress 70 for player

@ location of <who>
if distance between player's location and location of arg.1 > 10:
    send "&c%arg.1% is too far away."

@ owned by <name>
open gui with title "&8Online" with 1 rows for player:
    slot 1 is "player_head" owned by player.name named "&f%player.name%"

@ create world <name>
command /makearena:
    permission: "worlds.manage"
    trigger:
        send "&7Making the arena..."
        create world "arena" flat without structures
        teleport player to spawn of world "arena"

@ load world <name> / unload world <name>
command /closearena:
    permission: "worlds.manage"
    trigger:
        unload world "arena"
        send "&7The arena is closed."

@ delete world <name>
command /resetarena:
    permission: "worlds.manage"
    trigger:
        confirm "&cDelete the arena world and everything in it?":
            delete world "arena"
            create world "arena" flat without structures
            send "&aThe arena is new again."

@ created worlds
send "&7Worlds made here: &f" + join created worlds with ", "

@ <who>'s location
loop all players:
    draw particle circle with radius 2 using particle "flame" at loop-player's location

@ fire event <name>
on player kill:
    set {_victim} to victim
    fire event "kill" with {_victim}

on event "kill":
    add 1 to {%player%.kills}
    send "&7You defeated &f%{_victim}%"

@ schedule <function>(...) in <duration>
function end_vip({_who}):
    delete {%{_who}%.vip}
    send "&7Your VIP time is over." to {_who}

command /vip <target:player>:
    permission: "vip.give"
    trigger:
        set {%arg.1%.vip} to true
        schedule end_vip(arg.1) in 30 days as "vip %arg.1%"

@ cancel schedule <name>
cancel schedule "vip %arg.1%"

@ set fake block at <position> to <block>
on right click:
    if event.block is "stone":
        set fake block at event's location to gold block
        send "&6Only you can see that."

@ clear fake block at <position>
command /reveal:
    players only: true
    trigger:
        set fake block at player to glass
        wait 5 seconds
        clear fake block at player

@ item <name>:
item magic wand:
    blaze rod named "&dMagic wand" with lore "&7Right-click to cast" glowing

command /wand:
    trigger:
        give player magic wand

@ recipe for <item>:
recipe for 4 oak planks:
    ingredients: oak log

@ /hyperscript debug <player>
command /test:
    trigger:
        # Run /hyperscript debug <your name>, then /test, to watch these lines run.
        set {_roll} to random integer between 1 and 6
        if {_roll} > 3:
            send "&aHigh: %{_roll}%"
        else:
            send "&cLow: %{_roll}%"

@ is in region <name> / is not in region <name>
on block break:
    if player is in region "spawn":
        cancel event
        send "&cNot here."

@ is on cooldown <name> / is not on cooldown <name>
command /kit:
    trigger:
        if player is on cooldown "kit":
            set {_left} to cooldown "kit"
            send "&cWait %{_left}%."
            stop
        start cooldown "kit" of 1 hour
        give player 16 bread

@ start cooldown <name> of <duration>
on right click with stick:
    if player is on cooldown "zap":
        stop
    start cooldown "zap" of 3 seconds
    strike lightning at player

@ end cooldown <name>
command /resetkit <player>:
    permission: kits.admin
    trigger:
        end cooldown "kit" for arg.1
        send "&aDone."

@ cooldown <name>
command /kittime:
    trigger:
        set {_left} to cooldown "kit"
        if {_left} is set:
            send "&7Kit ready in &f%{_left}%"
        else:
            send "&aYour kit is ready."

@ shape: "<row>", "<row>", "<row>"
recipe for 1 golden apple:
    shape: " g ", "gag", " g "
    g: gold ingot
    a: apple

@ <letter>: <item>
recipe for 2 arrow:
    shape: "f", "s"
    f: feather
    s: stick

@ ingredients: <item>, <item>
recipe for 1 name tag:
    ingredients: paper, 2 stick

@ on right click with <item>:
on right click with compass:
    send "&7You are at &f%player.x%, %player.y%, %player.z%"

@ set fake blocks from <location> to <location> to <block>
command /cage:
    trigger:
        set {_a} to player's location offset by -1, 0, -1
        set {_b} to player's location offset by 1, 2, 1
        set fake blocks from {_a} to {_b} to glass
        send "&7A cage only you can see."

@ clear fake blocks from <location> to <location>
command /uncage:
    trigger:
        set {_a} to player's location offset by -1, 0, -1
        set {_b} to player's location offset by 1, 2, 1
        clear fake blocks from {_a} to {_b}

@ clear all fake blocks
on world change:
    clear all fake blocks

@ with lore <text>, <text>, ...
give player 1 diamond sword named "&6Excalibur" with lore "&7A fine blade", "&7Handle with care"

@ random item of <list> weighted by <list>
command /crate:
    trigger:
        set {_prizes} to ["bread", "gold_ingot", "diamond"]
        set {_prize} to random item of {_prizes} weighted by [70, 25, 5]
        give player 1 "%{_prize}%"
        send "&aYou won &f%{_prize}%&a!"

@ save inventory of <who> as <name>
command /arena:
    trigger:
        save inventory of player as "before-arena"
        clear inventory of player
        give player 1 iron sword
        send "&7Your things are safe. &f/leave &7gives them back."

@ restore inventory of <who> from <name>
command /leave:
    trigger:
        if player has saved inventory "before-arena":
            restore inventory of player from "before-arena"
            delete saved inventory "before-arena"
            send "&aYour things are back."

@ delete saved inventory <name>
on player join:
    # Left over from a round that never ended properly.
    if player has saved inventory "before-arena":
        restore inventory of player from "before-arena"
        delete saved inventory "before-arena"

@ has saved inventory <name> / does not have saved inventory <name>
on player quit:
    if player has saved inventory "before-arena":
        log "%player% left in the middle of a round"

@ summon ... at <position> with health <n> holding <item> dropping <item>, ...
command /boss:
    permission: boss.spawn
    trigger:
        summon zombie named "&cThe Warden" at player glowing with health 200 with damage 12 holding diamond sword wearing diamond helmet dropping 5 diamond, 1 nether star
        broadcast "&cA boss has appeared!"

@ with health <n>
summon iron golem named "&bGuardian" at player with health 400

@ with speed <n>
summon 5 zombie at player with speed 1.6

@ with damage <n>
summon zombie named "&4Brute" at player with damage 20

@ holding <item>
summon zombie at player holding iron sword enchanted with sharpness 3

@ wearing <item>, <item>
summon zombie at player wearing diamond helmet, iron chestplate, iron boots

@ dropping <item>, <item>
summon chicken named "&6Golden hen" at player dropping 3 gold ingot

@ glowing, silent, baby
summon villager at player glowing silent baby

@ set drops to <item>, <item>
on entity death:
    if event.entity is "creeper":
        set drops to 3 gunpowder, 1 tnt

@ add <item> to drops
on entity death:
    if event.entity is "zombie":
        if chance of 10%:
            add 1 emerald to drops

@ shoot <projectile> from <who>
on right click with blaze rod:
    if player is on cooldown "fireball":
        stop
    start cooldown "fireball" of 2 seconds
    shoot small fireball from player with speed 2

@ copy blocks from <location> to <location> as <name>
command /savearena:
    permission: arena.admin
    trigger:
        copy region "arena" as "arena-clean"
        send "&aThe arena as it is now was saved."

@ paste <name>
command /resetarena:
    permission: arena.admin
    trigger:
        paste "arena-clean"
        broadcast "&7The arena was reset."

@ delete copy <name>
command /forgetarena:
    permission: arena.admin
    trigger:
        delete copy "arena-clean"

@ smelting recipe for <item>:
smelting recipe for 2 gold ingot:
    from: gold block
    time: 5 seconds
    experience: 1

@ messages:
messages:
    en:
        welcome: "&aWelcome, %player%!"
    de:
        welcome: "&aWillkommen, %player%!"

on player join:
    send message "welcome"

@ message <name>
messages:
    en:
        greeting: "&7Hello!"
    es:
        greeting: "&7Hola!"

command /greet <player>:
    trigger:
        send message "greeting" for arg.1 to arg.1

@ make <creature> follow <who>
command /pet:
    trigger:
        summon wolf named "&b%player%'s pet" at player
        set {%player%.pet} to last summoned entity
        make {%player%.pet} follow player

@ make <creature> walk to <location>
command /callguard:
    trigger:
        summon iron golem at player
        make last summoned entity walk to location 10 blocks in front of player

@ make <creature> stay still / make <creature> move again
command /statue:
    trigger:
        summon zombie named "&7Statue" at player silent
        make last summoned entity stay still

@ make <who> ride <creature> / make <who> dismount
command /mount:
    trigger:
        summon horse at player
        make player ride last summoned entity

@ invisible
summon armor stand at player invisible holding diamond sword

@ small, marker, with arms, without gravity, without base plate
command /trophy:
    trigger:
        summon armor stand named "&6Champion" at player small with arms without base plate holding golden apple wearing diamond helmet

@ move camera of <who> from <location> to <location> over <duration>
on first join:
    set {_high} to player's location offset by 0, 25, 0
    move camera of player from {_high} to player's location over 4 seconds

@ stop camera of <who>
command /skip:
    trigger:
        stop camera of player
        send "&7Skipped."

@ set border of <who> to <n> blocks around <location>
command /plot:
    trigger:
        set border of player to 32 blocks around player's location
        send "&7This is your plot."

@ reset border of <who>
on world change:
    reset border of player

@ invite <who> to party
command /invite <player>:
    players only: true
    trigger:
        invite arg.1 to party
        send "&7%player% invites you to a party." to arg.1

@ accept party invite / decline party invite
command /accept:
    players only: true
    trigger:
        accept party invite
        if player is in a party:
            send "&a%player% joined." to party of player

@ leave party
command /leaveparty:
    players only: true
    trigger:
        leave party
        send "&7You left the party."

@ remove <who> from party
command /partykick <player>:
    players only: true
    trigger:
        remove arg.1 from party

@ disband party
command /disbandparty:
    players only: true
    trigger:
        send "&cThe party was ended." to party of player
        disband party

@ party of <who>
on chat:
    if message starts with "!":
        cancel event
        send "&d[Party] &f%player%: %message%" to party of player

@ party leader of <who>
command /leader:
    trigger:
        if player is in a party:
            send "&7Your party is led by &f" + party leader of player

@ party invites of <who>
command /invites:
    trigger:
        send "&7Invited by: &f" + party invites of player

@ <who> is in a party
on hit:
    if attacker is in a party:
        if party of attacker contains victim:
            cancel event

@ on queue <name> of <n>:
on queue "duels" of 2:
    for each {_name} in {_players}:
        send "&aA match was found!" to {_name}

@ add <who> to queue <name>
command /duel:
    players only: true
    trigger:
        add player to queue "duels"
        send "&7Waiting for an opponent..."

@ remove <who> from queue <name>
command /leavequeue:
    players only: true
    trigger:
        remove player from all queues
        send "&7You are no longer waiting."

@ queue <name>
command /waiting:
    trigger:
        send "&7In line: &f" + size of queue "duels"

@ <who> is in queue <name>
command /duel2:
    players only: true
    trigger:
        if player is in queue "duels":
            send "&cYou are already waiting."
            stop
        add player to queue "duels"

@ enchantment <name>:
enchantment lifesteal:
    max level: 3
    on hit:
        add {_level} to health of player

@ max level: <n>
enchantment thorns of fire:
    max level: 2
    on hurt:
        ignite attacker for 3 seconds

@ on hit:
enchantment lightning:
    on hit:
        if chance of 20%:
            strike lightning at victim

@ on hurt:
enchantment dodge:
    on hurt:
        if chance of 10%:
            cancel event
            send "&7Dodged!"

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

@ {_body}
on web request "/announce":
    broadcast "&e[Web] &f%{_body}%"

@ {_method}
on web request "/ping":
    log "%{_method}% from %{_address}%"

@ {_path}
on web request:
    log "Something asked for %{_path}%"

@ {_query}
on web request "/give":
    log "Asked with: %{_query}%"

@ {_address}
on web request "/vote":
    log "A vote arrived from %{_address}%"

@ /hyperscript test [script]
function double({_n}):
    return {_n} * 2

test "doubling":
    expect double(4) is 8

@ test "<what it shows>":
function price({_amount}):
    return {_amount} * 5

test "five coins each":
    expect price(3) is 15

@ expect <condition>
test "numbers add up":
    set {_total} to 2 + 2
    expect {_total} is 4

@ test log
command /hello:
    trigger:
        send "&aHello!"

test "hello says hello":
    execute player command "/hello"
    expect test log contains "Hello!"

@ /hyperscript search <word>
command /hello:
    trigger:
        send "&aHello, %player%!"

@ /hyperscript install <id>
command /hello:
    trigger:
        send "&aHello, %player%!"

@ /hyperscript update
command /hello:
    trigger:
        send "&aHello, %player%!"

@ replace regex <pattern> with <b> in <text>
on chat:
    # Hide anything that looks like an address.
    set chat message to replace regex "\\d+\\.\\d+\\.\\d+\\.\\d+" with "[hidden]" in message

@ regex matches of <pattern> in <text>
command /numbers <text>:
    trigger:
        set {_found} to regex matches of "\\d+" in args
        send "&7Numbers: &f" + join {_found} with ", "

@ regex groups of <pattern> in <text>
command /setting <text>:
    trigger:
        set {_parts} to regex groups of "(\\w+)=(\\d+)" in arg.1
        if size of {_parts} is 2:
            send "&7" + item 1 of {_parts} + " is " + item 2 of {_parts}

@ try parse <text> as number
command /pay <amount>:
    trigger:
        set {_amount} to try parse arg.1 as number
        if {_amount} is not set:
            send "&c%arg.1% is not a number."
            stop
        send "&aPaying %{_amount}%."

@ game version of <who>
on player join:
    if game version of player is not "1.21.4":
        send "&eYou are on %game version of player%. Some things look best on 1.21.4."

@ drop loot <table> at <location>
command /dungeonloot:
    permission: loot.admin
    trigger:
        drop loot "chests/simple_dungeon" at player's location

@ fill chest at <location> with loot <table>
command /restock:
    permission: loot.admin
    trigger:
        fill chest at target block of player with loot "chests/village/village_weaponsmith"
        send "&aRestocked."

@ advancement "<name>":
advancement "first kill":
    title: "&cFirst blood"
    description: "Win a fight against another player"
    icon: iron sword
    frame: challenge

@ title: / description:
advancement "rich":
    title: "&6Rich"
    description: "Own a thousand coins"

@ icon: <item>
advancement "miner":
    icon: diamond pickaxe

@ frame: task, goal or challenge
advancement "dragon":
    frame: challenge

@ parent: "<name>"
advancement "miner":
    icon: diamond pickaxe

advancement "master miner":
    parent: "miner"
    icon: netherite pickaxe

@ announce: false
advancement "tutorial":
    announce: false

@ hidden: true
advancement "secret room":
    hidden: true

@ grant advancement <name> to <who>
advancement "welcome":
    title: "Welcome"

on first join:
    grant advancement "welcome" to player

@ revoke advancement <name> from <who>
advancement "welcome":
    title: "Welcome"

command /again:
    trigger:
        revoke advancement "welcome" from player

@ <who> has advancement <name>
advancement "vip":
    title: "VIP"

command /lounge:
    trigger:
        if player has advancement "vip":
            send "&aWelcome in."
        else:
            send "&cMembers only."

@ send discord message <text> to channel <id>
on player join:
    send discord message "%player% joined the server" to channel "123456789012345678"

@ on discord message <id>:
on discord message "123456789012345678":
    broadcast "&9[Discord] &f%{_user}%&7: %{_message}%"

@ /hyperscript variables upload
command /coins:
    trigger:
        # Saved variables such as this one are what the upload sends.
        send "&7You have &f%{%player%.coins}% &7coins."

@ /hyperscript docs <word>
command /hello:
    trigger:
        send "&aHello, %player%!"

@ limit: <n> per <duration>
on chat:
    limit: 3 per 5 seconds
    add 1 to {%player%.messages}

@ ask <who> <text> with anvil into <variable>
command /pet:
    players only: true
    trigger:
        ask player "Name your pet" with anvil into {_name}
        if {_name} is "":
            send "&7Maybe later."
            stop
        set {%player%.pet} to {_name}
        send "&aYour pet is called %{_name}%."

@ open trades <title>:
command /baker:
    players only: true
    trigger:
        open trades "&eBaker":
            1 emerald for 6 bread
            3 emerald for 1 cake

@ <cost> for <result>
command /miner:
    players only: true
    trigger:
        open trades "&7Miner":
            16 cobblestone for 1 emerald

@ <cost> and <cost> for <result>
command /smith:
    players only: true
    trigger:
        open trades "&6Smith":
            4 emerald and 1 stick for 1 iron sword

@ create npc <name> at <location>
command /setguide:
    permission: npc.admin
    players only: true
    trigger:
        create npc "&aGuide" at player's location
        send "&aThe guide stands here now."

@ create npc <name> as <entity> at <location>
command /setguard:
    permission: npc.admin
    players only: true
    trigger:
        create npc "&7Guard" as iron golem at player's location

@ delete npc <name>
command /removeguide:
    permission: npc.admin
    trigger:
        delete npc "guide"

@ on npc click <name>:
on npc click "guide":
    send "&aGuide: &fThe arena is that way."

@ npc <name>
command /announce:
    permission: npc.admin
    trigger:
        make npc "guide" say "The event starts in five minutes!"

@ all npcs
command /npcs:
    trigger:
        send "&7Characters: &f" + join all npcs with ", "

@ run sql <statement>
on load:
    run sql "CREATE TABLE IF NOT EXISTS visits (player VARCHAR(16), day VARCHAR(10))"

@ sql rows of <query>
command /visits:
    trigger:
        async:
            set {_rows} to sql rows of "SELECT day FROM visits WHERE player = ?" with player.name
            send "&7You have visited on %size of {_rows}% day(s)."

@ with <value>, <value>
on player join:
    run sql "INSERT INTO visits (player, day) VALUES (?, ?)" with player.name, server.date

@ <text> as offlineplayer
command /seen <player>:
    trigger:
        set {_who} to arg.1 as offlineplayer
        if {_who} has not played before:
            send "&c%arg.1% has never played here."
            stop
        send "&7%{_who}% was last on " + last seen of {_who} formatted as "d MMMM yyyy"

@ uuid of <who>
command /uuid <player>:
    trigger:
        set {_who} to arg.1 as offlineplayer
        if {_who} has played before:
            send "&7%{_who}%: &f" + uuid of {_who}

@ name of <who>
command /realname <player>:
    trigger:
        send "&7That is &f" + name of arg.1

@ all offline players
command /everyone:
    permission: staff.everyone
    trigger:
        async:
            set {_all} to all offline players
            send "&7%size of {_all}% player(s) have played here."

@ <who> has played before
command /known <player>:
    trigger:
        if arg.1 has played before:
            send "&a%arg.1% has been here."
        else:
            send "&c%arg.1% has never joined."

@ type: <creature>
mob "Guard Dog":
    type: wolf
    health: 40

command /dog:
    players only: true
    trigger:
        spawn mob "Guard Dog" at player's location

@ name: <text>
mob "elite":
    type: zombie
    name: "&c&lElite Zombie"
    health: 60

@ health: <n>
mob "Tank":
    type: iron golem
    health: 400

@ damage: <n>
mob "Brute":
    type: zombie
    damage: 12

@ speed: <n>
mob "Runner":
    type: zombie
    speed: 1.6
    baby: true

@ holding: <item>
mob "Knight":
    type: zombie
    holding: diamond sword

@ wearing: <item>, <item>
mob "Knight":
    type: zombie
    wearing: diamond helmet, diamond chestplate

@ drops: <item>, <item>
mob "Treasure Zombie":
    type: zombie
    drops: 5 diamond, 1 golden apple

@ experience: <n>
mob "Sage":
    type: villager
    experience: 200
    drops: nothing

@ glowing: true / silent: true / baby: true
mob "Marked One":
    type: zombie
    glowing: true
    silent: true

@ on spawn:
mob "Herald":
    type: zombie
    on spawn:
        broadcast "&cA herald has appeared!"

@ on death:
mob "Bounty":
    type: zombie
    health: 80
    on death:
        if player is set:
            add 100 to {%player%.coins}
            send "&a+100 coins for the bounty."

@ spawn mob <name> at <location>
command /boss:
    permission: op
    players only: true
    trigger:
        spawn mob "Frost Giant" at player's location
        set {_giant} to last summoned entity
        make {_giant} target player

@ mob name of <entity>
command /summongiant:
    permission: op
    players only: true
    trigger:
        spawn mob "Frost Giant" at player's location
        set {_made} to last summoned entity
        send "&7That is a &f" + mob name of {_made}

@ currency "<name>":
currency "tokens":
    start: 5

command /tokens:
    players only: true
    trigger:
        set {_tokens} to currency "tokens" of player
        send "&7Tokens: &e%{_tokens}%"

@ currency <name> of <who>
on player kill:
    add 1 to currency "tokens" of player
    send "&e+1 token."

@ pay <n> of currency <name> from <who> to <who>
command /tip <player>:
    players only: true
    trigger:
        if currency "tokens" of player < 1:
            send "&cYou have no tokens."
            stop
        pay 1 of currency "tokens" from player to arg.1
        send "&aYou tipped %arg.1% a token."

@ placeholder "<name>":
placeholder "visits":
    return {%player%.joins}

@ lerp(from, to, t)
set {_height} to lerp(60, 80, 0.5)
send "&7Half way up is %{_height}%."

@ between(text, before, after)
set {_inner} to between("Hello [world]!", "[", "]")
send "&7%{_inner}%"

@ nearest player to <location>
set {_who} to nearest player to player's location
if {_who} is set:
    send "&7Closest: &f%{_who}%"

@ block (below/above) <who>
on player jump:
    if block below player is "slime_block":
        push player upward with force 2

@ <number> is [not] (even/odd)
if level of player is even:
    send "&7An even level."

@ chance of <n>%:
on block break:
    chance of 10%:
        give player 1 emerald
        send "&aLucky!"
