https://github.com/seanpray/mc-server-ping
Query Minecraft server information and deserialize the result into JSON
https://github.com/seanpray/mc-server-ping
Last synced: about 1 month ago
JSON representation
Query Minecraft server information and deserialize the result into JSON
- Host: GitHub
- URL: https://github.com/seanpray/mc-server-ping
- Owner: seanpray
- License: mit
- Created: 2022-07-28T05:00:58.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-07T14:37:41.000Z (almost 3 years ago)
- Last Synced: 2025-03-29T02:52:20.238Z (about 2 months ago)
- Language: Rust
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### mc-server-ping
Lightweight and small library to query minecraft server information.
#### usage
```rust
use mc_server_ping::ServerStatus;fn main() {
let mut server = ServerStatus::new("mc.hypixel.net", 25565, None, None);
server.query().unwrap();
let response = server.to_json().unwrap();
println!("{}", serde_json::to_string_pretty(&response).unwrap());
}
```
or
`cargo run --example main`###### example response
```json
{
"description": " §aHypixel Network §c[1.8-1.19]\n §b§lNEW: DROPPER §7§l| §6§lSUMMER EVENT§7§l+§e§lSALE",
"favicon": "data:image/png;base64...",
"players": {
"max": 200000,
"online": 58389,
"sample": []
},
"version": {
"name": "Requires MC 1.8 / 1.19",
"protocol": 47
}
}
```
With smaller servers the sample array is populated with players and their usernames and UUIDs.The server does NOT need `enable-query` true in `server.properties`, this fetches the same data as the multiplayer screen.