Sorry for my terrible English.
Heartbeat plugin can help you make monitoring panel on web site more informative.
You don’t need to constantly poll the status of the server.
Now server sends information about themselves on web site.
Download : Heartbeat v1.0.1
Sources : GitHub
Features
- Sending information about basic parameters such as motd, version, gamemode, whitelist (on/off), online_mode (on/off);
- Sending list of players on the server;
- Sending list of plugins on the server;
- Http POST-request with JSON content.
Configuration file
// URL to server status handler script url: "http://127.0.0.1/status/status.php"// User-Agent for server status message
user-agent: “SpongePlugin/1.0”// Status message interval (in seconds)
interval: 60
Server status message format
{ "server": { "ip": "localhost", "port": 25565, "version": "1.8", "motd": "A Minecraft Test Server", "max_players": 50, "current_players": 2, "gamemode": "survival", "whitelist": false, "online_mode": true }, "plugins": ["Forge","sponge","heartbeat"], "players": ["TaoGunner","TestUser"] }----------
Simple PHP-script example
<?php if (($_SERVER['REQUEST_METHOD'] == 'POST') && (stripos($_SERVER["CONTENT_TYPE"], "application/json") === 0) && $_SERVER['HTTP_USER_AGENT'] == 'SpongePlugin/1.0') { $data = json_decode(file_get_contents('php://input'), TRUE); // Now you can save server data in database. echo 'Server port : '.$data['server']['port']; echo 'MOTD : '.$data['server']['motd']; echo 'Players online : '.$data['server']['current_players']; } ?>---------- **How can i use it?**
- Save server status with timestamp in database (MySQL etc.) and show monitoring panel on your website;
- Messages from server didn’t come for 2 minutes? Show offline status on monitoring panel.