HungerBridge for Paper is a standard Bukkit plugin that starts a lightweight HTTP server when your Paper or Purpur server enables it. The HTTP API lets HungerLib (and any compatible HTTP client) execute console commands, write server logs, and query live TPS and player data — without the complexity of RCON. This guide walks you through installation, configuration, and the internals that power command dispatch and output capture.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/iFamishedX/HungerBridge/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Confirm your server environment before installing:Server Software
Paper or Purpur — any build targeting Minecraft 1.21.11
Paper API
API version 1.21, as declared in
plugin.ymlMinecraft
1.21.11 — the same version required by HungerBridge Fabric if you run a mixed setup
Java
Java 21 or later — required by Paper 1.21.x
Installation
Download the JAR
Grab the latest
HungerBridge-paper-<version>.jar from the GitHub Releases page. Choose the file with the paper classifier.Place the JAR in your plugins folder
Copy the downloaded JAR into the
plugins/ directory of your Paper or Purpur server:Start the server
Launch the server. On the first run, HungerBridge generates a default
config.yaml with a randomly generated auth key and logs the following:Review the config file
Open
plugins/HungerBridge/config.yaml and adjust settings for your environment. The auth.key value must be copied into your HungerLib configuration:plugins/HungerBridge/config.yaml
Configuration Reference
| Key | Default | Description |
|---|---|---|
port | 30007 | TCP port the HTTP server listens on |
auth.key | (random UUID) | Shared secret sent as the X-Auth-Key header |
v2-endpoints.* | all true | Toggle individual v2 API routes on or off |
v1-endpoints.* | all false | Toggle legacy v1 routes |
legacy-endpoints.* | all false | Toggle plaintext legacy routes |
players.max-list | 50 | Maximum player names returned by /v2/players |
Plugin Internals
Lifecycle
HungerBridge is a standardJavaPlugin. Its HTTP server starts and stops entirely inside the two Bukkit lifecycle methods:
BridgeServer.start() binds the configured TCP port and registers all enabled endpoint handlers. BridgeServer.stop() calls HttpServer.stop(0) and shuts down the cached thread pool immediately.
PaperServerInfoProvider is instantiated in onEnable() but is not passed into BridgeServer. TPS and tick-time data are read directly inside PaperCommandExecutor using the Bukkit API — PaperServerInfoProvider is unused in the current release.Command Dispatch
Paper commands are dispatched on the server main thread using the Bukkit scheduler:dispatchCommand runs with getConsoleSender() as the source, which grants the command full console-level permissions. For fire-and-forget calls (no output capture), this task is submitted and the HTTP handler returns immediately. When output is required, a CompletableFuture blocks the HTTP handler thread until the main-thread task completes.
Output Capture via Log4j
Command output is captured by temporarily installing a customAbstractAppender named HungerBridgeCapture on the Log4j root logger. The root logger is used because it is the single reliable capture point for all output on both Paper and Purpur.
The behaviour depends on the show_console field in the request body:
- show_console: false (default)
- show_console: true
All existing appenders (console writer, file appender, etc.) are removed before the command runs, so output is silently captured without appearing in the server console or log files. After the command finishes, every original appender is restored.
TPS Reporting
Paper exposes TPS data throughBukkit.getServer().getTPS(), which returns a double[] of three values. HungerBridge maps these directly to the /v2/tps response fields:
| Array Index | Response Field | Meaning |
|---|---|---|
tps[0] | tps | Recent TPS (short window) |
tps[1] | tps_1m | 1-minute average TPS |
tps[2] | tps_5m | 5-minute average TPS |
tps[2] | tps_15m | Reuses the 5-minute value — Paper exposes only 3 values |
tick_time_ms is computed from Bukkit.getServer().getTickTimes(), which returns a long[] of recent tick durations in nanoseconds. HungerBridge averages the full array and converts to milliseconds by dividing by 1_000_000:
If
getTPS() or getTickTimes() returns an empty array (which can happen very early in server startup), the corresponding field is reported as -1.0 in the API response rather than throwing an exception.