A plugin that opens a http endpoint to allow server stats to be used on sites.
Duck's API (Paper Plugin)
A beginner-friendly Minecraft Paper plugin that opens a tiny HTTP API endpoint:
GET /status- Returns JSON with:
- server status (
online,offline,restarting) - online player count
- max player count
- staff count using permsssion
- server status (
1) What this plugin does (in plain English)
When your Minecraft server is running, this plugin can answer a web request like:
http://YOUR_SERVER_IP:8080/status
And return data like:
{
"status": "online",
"players": {
"online": 5,
"max": 100
}
}
This is useful if you want a website, Discord bot, or dashboard to show server status.
2) Requirements
You need:
- A Paper Minecraft server (latest stable recommended)
- Java 21 installed on the machine where you build/run this plugin
- Access to your server files (
pluginsfolder)
3) Install on your Minecraft Paper server
- Stop your Minecraft server.
- Copy the plugin jar into your server's
plugins/folder. - Start the server.
- Wait until startup finishes.
- Stop the server again (optional but recommended so config file is written cleanly).
The plugin auto-creates config.yml on first run.
4) Configure the API port
- Open this file:
plugins/DucksAPI/config.yml
- You will see:
api:
port: 8080
- Change
8080if needed (for example8090). - Save the file.
- Start or restart your server.
(You may need to expose the port via your server host(if not local) for this to work.
5) Test that it works
From the server machine
Run:
curl http://127.0.0.1:8080/status
(Replace 8080 if you changed the port.)
If working, you will get JSON response.
From another machine
Use:
http://SERVER_PUBLIC_IP:8080/status
If it fails externally, see firewall/port sections below.
6) Open firewall/hosting rules (important)
You must allow inbound TCP traffic on the API port.
- If you use a game host panel: open the port there.
- If you use a VPS/cloud: open it in cloud firewall/security group.
- If you use Linux firewall (UFW):
sudo ufw allow 8080/tcp
Then reload/check firewall if needed.
7) Home hosting: router port forwarding
If your Minecraft server is at home and you want external access:
- Log into your router.
- Find Port Forwarding.
- Forward external TCP port (example
8080) to internal server IP + same port. - Make sure server machine has static local IP (or DHCP reservation).
Without this, outside users cannot reach your API.
8) Domain + DNS setup (easy explanation)
Important
DNS only maps names to IPs. DNS does not map URL paths like /api.
So this:
- ✅
api.xynex.uk(works with DNS) - ❌
xynex.uk/api(needs reverse proxy, not DNS alone)
Recommended method
- Create DNS record:
- Type:
A - Name:
api - Value: your server public IPv4
- Type:
- Wait for DNS to propagate.
- Use endpoint:
http://api.xynex.uk:8080/status
If you want https://xynex.uk/api, configure reverse proxy (Nginx/Caddy) to route /api to this plugin.
9) Connect a website frontend safely
Safety checklist
- Prefer HTTPS (via reverse proxy)
- Keep API behind a reverse proxy in production
- Restrict CORS at proxy to your own domain
- Consider rate limiting to avoid abuse
Example JavaScript fetch
<script>
async function loadServerStatus() {
try {
const response = await fetch("https://api.xynex.uk/status", {
method: "GET",
headers: { "Accept": "application/json" }
});
if (!response.ok) {
throw new Error("HTTP " + response.status);
}
const data = await response.json();
document.getElementById("status").textContent = data.status;
document.getElementById("online").textContent = data.players.online;
document.getElementById("max").textContent = data.players.max;
} catch (error) {
console.error("Failed to load status:", error);
}
}
loadServerStatus();
</script>
10) Release checklist (for publishing later)
If you want to release this plugin publicly:
- Update version in
build.gradle.ktsandplugin.yml - Run build and verify startup on a test Paper server
- Verify
/statusoutput with real players online - Write changelog/release notes
- Upload final jar to your distribution platform
- Include config example and quick-start instructions (this README)
11) Troubleshooting
"Address already in use"
Another app is already using the port.
- Change
api.portinconfig.yml - Restart server
Endpoint works locally but not publicly
Usually firewall, host panel, security group, or router forwarding issue.
Empty or wrong response
Check server console for plugin startup errors and verify plugin loaded.
12) Uninstall
- Stop server
- Remove plugin jar from
plugins/ - (Optional) delete plugin config folder
- Start server
Done.