2025-07-17 09:19:51 +08:00

87 lines
3.5 KiB
Markdown

## English
[中文简体](https://git.branulf.top/Branulf/ServerPlayerOnlineTracker/src/branch/master/README.md)
# ServerPlayerOnlineTracker - Server Player Online & Status Tracker
A simple Fabric server-side mod designed to track player online time, display real-time server status, and provide a beautiful web interface.
## Key Features
* **Player Online Time Tracking**
* Records total online time, last 30 days, and last 7 days online time for players.
* Supports tracking whitelisted players only (configurable in the config file).
* Automatic data saving to prevent data loss from server crashes.
* **Server Status Monitoring**
* Real-time display of server memory usage (used/available/percentage).
* Real-time display of server disk usage (total/used/available/percentage).
* Real-time display of server performance metrics (TPS/MSPT).
* Shows server uptime, version, current player count, max players, MOTD, and processor cores.
* **Web Interface**
* Provides an intuitive and responsive web interface for easy viewing of all statistics.
* Supports dark/light theme toggling.
* Automatic data refresh.
* **In-Game Command**
* `/onlineTime [page]` to view the player online time leaderboard in-game.
* **Multi-language Support**
* Supports Simplified Chinese (`zh_cn`) and English (`en_us`).
* Language can be switched in the configuration file.
* **Update Checker**
* Automatically checks for new mod versions on startup.
## Installation
1. Ensure you have Fabric Loader installed on your Minecraft server (recommended 0.15.0+).
2. Download the latest `ServerPlayerOnlineTracker-*.jar` file.
3. Place the downloaded `.jar` file into your server's `mods` folder.
4. Start your server.
## Usage
### Web Interface
After the mod starts, a web server will automatically launch on your configured port (default `60048`).
1. Access it in your browser by navigating to `http://YOUR_SERVER_IP:60048` to view all statistics.
2. If the port is occupied or you wish to change it, modify the `webPort` field in the `config/playertime-config.json` file.
### In-Game Command
* `/onlineTime`: View the first page of the player online time leaderboard.
* `/onlineTime <page>`: View a specific page of the player online time leaderboard.
## Configuration
Upon the first run of the mod, a `playertime-config.json` file will be generated in your server's `config` folder. You can edit this file to adjust the mod's behavior.
```json
{
"webPort": 60048, // Port for the web server to listen on, default 60048
"language": "zh_cn", // Language for web and in-game messages, options: "zh_cn" or "en_us"
"whitelistOnly": true, // Whether to track and display online time only for whitelisted players, default true
"saveIntervalMinutes": 5 // Interval for automatic player data saving in minutes, default 5 minutes, set to 0 to disable
}
```
## API
[API Documentation](https://git.branulf.top/Branulf/ServerPlayerOnlineTracker/src/branch/master/README_API.md)
## Compatibility
* **Minecraft Version:** 1.21.4+
* **Fabric Loader:** 0.16.10+
* **Dependencies:** Fabric API
## License
This project is open-source under the [GPL3 License](https://www.gnu.org/licenses/gpl-3.0.en.html).
## Links
* **Source Code:** [https://git.branulf.top/Branulf/ServerPlayerOnlineTracker](https://git.branulf.top/Branulf/ServerPlayerOnlineTracker)
* **Homepage:** [https://git.branulf.top/Branulf](https://git.branulf.top/Branulf)
## Credits
* **Author:** BRanulf