Added RCON support

This commit is contained in:
Snowiiii committed 2024-08-10 23:53:32 +02:00
1 parent 50dcbfeb6d
commit 414cf3190c
12 files changed
+386 -16

No files matched your search

+10 -1
View File
@@ -19,6 +19,7 @@ pub mod client;
pub mod commands;
pub mod config;
pub mod entity;
pub mod rcon;
pub mod server;
pub mod util;
@@ -27,6 +28,8 @@ pub mod util;
async fn main() -> io::Result<()> {
use std::{cell::RefCell, time::Instant};
use rcon::RCONServer;
let time = Instant::now();
let basic_config = BasicConfiguration::load("configuration.toml");
@@ -58,6 +61,7 @@ async fn main() -> io::Result<()> {
let mut unique_token = Token(SERVER.0 + 1);
let use_console = advanced_configuration.commands.use_console;
let rcon = advanced_configuration.rcon.clone();
let mut connections: HashMap<Token, Rc<RefCell<Client>>> = HashMap::new();
@@ -73,10 +77,15 @@ async fn main() -> io::Result<()> {
stdin
.read_line(&mut out)
.expect("Failed to read console line");
handle_command(&mut commands::CommandSender::Console, out);
handle_command(&mut commands::CommandSender::Console, &out);
}
});
}
if rcon.enabled {
tokio::spawn(async move {
RCONServer::new(&rcon).await.unwrap();
});
}
loop {
if let Err(err) = poll.poll(&mut events, None) {
if interrupted(&err) {