HyperScript
Docs

Configuration

Settings live in plugins/HyperScript/config.yml. Changes need a server restart.

send-analytics: true
language: english         # english | french | spanish | portuguese | german
combat-time: "15s"        # how long "player is in combat" holds after a hit
afk-time: "5m"            # how long doing nothing makes "player is afk"
money-format: "$%amount%" # how money(...) writes an amount
limits:                   # the most HyperScript keeps going by itself; see Limits below
  particle-shapes: 200
  particles-a-tick: 3000
  slow-down-below-tps: 15
  floating-texts: 300
  temporary-blocks: 5000
  structure-blocks: 250000
word-filter: censor       # censor | block: what happens to chat with a blocked word in it
mute-commands: [msg, tell, w, whisper, me, r, reply, say]   # what a muted player cannot use
hot-reloading: true

storage:
  type: json          # json | csv | sqlite | h2 | mysql
  autosave: "5m"
  shared-variables: false   # {shared.name} is the same on every server that uses the database
  shared-refresh: "2s"
  sqlite:
    file: "data.db"
  csv:
    file: "data.csv"
  h2:
    file: "data-h2"
  mysql:
    host: "localhost"
    port: 3306
    database: "minecraft"
    username: "root"
    password: ""
    use-ssl: false

backups:
  enabled: true
  interval: "1h"
  keep: 24

update-check: true
auto-update: false        # true downloads newer versions by itself; they take effect at the next restart
log-script-errors: true
notify-script-errors: true
sidebar-numbers: false    # true shows the numbers beside the lines of a sidebar
loop-limit: 100000
player-error-message: "&cSomething went wrong with that. The staff have been told."

files:
  enabled: true

web:
  enabled: true
  allow-private-addresses: false
  server:               # the plugin's own web address, for 'on web request'
    enabled: false
    port: 8765
    bind: "0.0.0.0"
    token: ""

discord:
  webhooks: {}
  bot:
    enabled: false
    token: ""
    guild-id: ""
    read-messages: false

options-file: false       # every script's options: in one options.yml
update-project: hyperscript

Durations are a number and a unit: 30s, 5m, 1h, 1d.

loop-limit is how often a loop <n> times may be asked to go round, and how often a while may go round without waiting, before the script is stopped as runaway: from 1,000 to 50,000,000. update-project is the name /hyperscript update looks for on Modrinth. language is the language scripts are written in; see Scripts in another language.

log-script-errors writes a line to the console when a script fails while it is running, and notify-script-errors also tells players with hyperscript.admin in chat, at most once a minute for the same message. Mistakes found when a script loads are always reported.

Limits

Some lines keep something going after they have run: a particle shape that stays, text in front of a player, a block that is put back later. HyperScript does the keeping, every tick, and limits: in config.yml says how much of it there may be, so that a script written with too free a hand cannot slow the server down.

SettingUnless changedWhat happens beyond it
particle-shapes200A new shape that stays takes the place of the oldest
particles-a-tick3000Shapes wait for their next turn, so they are drawn less often; the console is told, at most once every five minutes
slow-down-below-tps15Not a limit but a brake: while the server manages fewer ticks a second than this, shapes that stay are drawn half as often
floating-texts300A new one takes the place of the oldest
temporary-blocks5000set block ... for does nothing until some have been put back

/hyperscript timings shows how much of each there is right now and how many milliseconds of a tick it takes. A tick has fifty; anything of HyperScript's taking more than two is shown yellow, more than five red.

Update check

With update-check: true, HyperScript asks its website once, each time the server starts, which version is the newest (https://hyperscript.monoforge.net/api/latestversion). If a newer one exists it says nothing in the console; instead, operators and players with hyperscript.admin are told when they join, and /hyperscript status shows it.

Usage numbers

With send-analytics: true (the default) the plugin tells the HyperScript website that a server is running it: once at start, every half minute, a moment after players join or leave, and once at stop. It sends:

It never sends player names, addresses, script contents, world names or the names of other plugins. send-analytics: false sends nothing at all. While it is on, the console says so at every start.

Hot reloading

With hot-reloading: true, HyperScript watches plugins/HyperScript/scripts/. Saving, creating or deleting a .hs file re-parses the scripts about half a second later, on the server thread, exactly as /hyperscript reload would. The console reports the result:

[HyperScript] Scripts changed on disk. Loaded 2 script(s): 9 command(s), 6 event handler(s)

Storage and fallback

Variables are always held in memory while the server runs. storage.type decides where they are saved:

storage.typeSaved toRead fromSet up
json (default)data.jsondata.jsonNothing to do
csvdata.csv and data.jsondata.csvNothing to do: the file is made by itself. A spreadsheet opens it
sqliteThe SQLite file data.db and data.jsonThe SQLite fileNothing to do: the database is made by itself
h2The H2 file data-h2.mv.db and data.jsonThe H2 fileNothing to do on Minecraft 1.17 and newer: the server downloads H2 the first time, and the database is made by itself
mysqlThe MySQL/MariaDB server and data.jsonThe MySQL serverA server and a database of yours, given under storage.mysql

Which is fastest? For scripts, none: while the server runs every variable is in memory, and a script never waits for a file or a database. The kinds differ in what you can open the data with (csv in a spreadsheet, sqlite and h2 with a database tool, mysql from several servers and from a website), and that is what to choose by. json stays the default because it needs nothing and is written in every mode anyway.

data.csv has a row for each variable: whose it is (global, or a player's id), its name, and its value the way data.json writes it. Change it by hand only while the server is stopped; what you change is read when it starts.

data.json is written in every mode, which is what makes the fallback work:

/hyperscript status shows which store is active right now.

Things to know:

Backups

With backups.enabled: true, HyperScript saves all pending changes and then copies data.json to plugins/HyperScript/Backups/data-<date>_<time>.json every backups.interval. Only the newest backups.keep files are kept (0 keeps them all). To restore, stop the server, replace data.json with a backup, and start it again.

Backups are copies of data.json, so they are useful in every storage mode; with a database they are a second, independent copy. A folder written backups by an older version is renamed to Backups, with what is in it.