mcping
is a Rust crate that can ping a Minecraft server and collect ping information such as the MOTD, max player count, player sample, etc.
Note: mcping
currently only supports Minecraft Java edition.
```rust // Ping the server and gather status information and latency. let (latency, status) = mcping::getstatus("mc.hypixel.net", Duration::fromsecs(10))?;
println!("latency: {}", latency); print!("version: {}", status.version.name); println!("description: {}", status.description.text()); println!("players: {}/{}", status.players.online, status.players.max); ```
A more complete example can be found in the cli
example (examples/cli.rs
) and can be run with cargo run --example cli
.
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.