Skip to main content

Starting and Stopping

The web server lifecycle can be managed both automatically (plugin startup/shutdown) and manually (in-game commands).

Automatic Lifecycle

Event Server Action
Plugin enable Web server starts automatically after config validation
Plugin disable Web server stops, all handlers are cleaned up, GraalJS contexts are closed
Config reload (/zyveraweb reload) Reloads config.yml but does not restart the server

Manual Control

Use the /zyveraweb server command to control the server at runtime:

Command Action
/zyveraweb server start Start the web server
/zyveraweb server stop Stop the web server
/zyveraweb server restart Stop, then start the web server

Permission: zyveraweb.server.command (default: op)

What Happens on Start

  1. Reads host, port from config.
  2. Determines server mode: if any site has an ssl block, starts HTTPS on the public port + HTTP on internal port; otherwise starts HTTP on the public port.
  3. Parses virtual host sites from config.
  4. Creates endpoint handlers:
    • Virtual host handler for routing
    • Or a single file handler if no sites configured
  5. Installs npm dependencies for Node.js projects (async).
  6. Creates an HttpServer or HttpsServer instance.
  7. Binds to the configured host:port.
  8. Registers cleanup tasks (rate limiter garbage collection).

What Happens on Stop

  1. The HTTP server stops accepting new connections.
  2. All GraalJS contexts are closed.
  3. Existing requests complete normally.

Checking Server Status

/zyveraweb

The status shows either Running (green) or Stopped (red) next to "Web Server".