-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
So I tried using rcon with tokio and looks like there's none but I figured out by myself.
For anyone who wondering what is tokio example looks like, here's example code.
use rcon;
use toml;
use std;
use tokio;
#[tokio::main]
async fn main(){
let config: toml::Value = toml::from_str(include_str!("../config.toml")).unwrap();
let mut server = <rcon::Connection<tokio::net::TcpStream>>::builder()
.enable_minecraft_quirks(true)
.connect(format!("{}:{}", config["server"]["ip"].as_str().expect("Server IP isn't specified"), config["server"]["port"].as_str().unwrap_or("25575")), config["server"]["password"].as_str().unwrap())
.await.unwrap();
println!("Connected to the server! ({})\nRun `exit` command to exit the program or CTRL + C!", config["server"]["ip"].as_str().unwrap());
loop {
println!("Summoning A Zombie ");
let res = server.cmd("summon minecraft:zombie -775.65 26.00 -180.72 ").await;
if res.is_err() {
println!("Server Error Out!");
continue
}
println!("Server Response: {}", res.unwrap());
}
println!("Bye!")
}Miesvanderlippe
Metadata
Metadata
Assignees
Labels
No labels