Implementations of Server List ping, Query, and RCON using the Minecraft networking protocol.
Maybe in the future there will be a CLI to access these features as well.
To use this library, just run cargo add mc-query
or add mc-query = "0.1.0"
to your Cargo.toml
.
You can read the docs here.
status
to get basic server information```rs use mc_query::status; use tokio::io::Result;
async fn main() -> Result<()> { let data = status("mc.hypixel.net", 25565).await?; println!("{data:#?}");
Ok(())
} ```
RconClient
to run commands via RCON```rs use mc_query::rcon::RconClient; use tokio::io::Result;
async fn main() -> Result<()> { let mut client = RconClient::new("localhost", 25565); client.authenticate("supersecretrconpassword").await?;
let response = client.run_command("time set 0").await?;
println!("{response}");
Ok(())
} ```
(Query still under development...)
Some tests in this library require a minecraft server to be running on localhost
.
If you are contributing a feature or bugfix that involves one of these tests,
run the convienient testing script ./test
(or py -3 test
on Windows).
This requires a decently modern version of Python 3, and a recent version of java to run the server.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
This project is in no way involved with or endorsed by Mojang Synergies AB or Microsoft Corporation. Any use of their services (including running some tests in this library) requires you to agree to their terms.