tokio: Support RCON

This commit is contained in:
Snowiiii committed 2024-10-19 18:12:06 +02:00
1 parent 2287564973
commit 75e7b0a8e8
15 files changed
+166 -152

No files matched your search

+9 -4
View File
@@ -1,3 +1,5 @@
use pumpkin_core::text::TextComponent;
use crate::commands::dispatcher::InvalidTreeError::{
InvalidConsumptionError, InvalidRequirementError,
};
@@ -24,11 +26,14 @@ pub struct CommandDispatcher<'a> {
/// Stores registered [CommandTree]s and dispatches commands to them.
impl<'a> CommandDispatcher<'a> {
pub fn handle_command(&self, sender: &mut CommandSender, server: &Server, cmd: &str) {
pub async fn handle_command(&self, sender: &mut CommandSender<'a>, server: &Server, cmd: &str) {
if let Err(err) = self.dispatch(sender, server, cmd) {
// sender.send_message(
// TextComponent::text(&err).color_named(pumpkin_core::text::color::NamedColor::Red),
// )
sender
.send_message(
TextComponent::text_string(err)
.color_named(pumpkin_core::text::color::NamedColor::Red),
)
.await;
}
}