From 02b2716332cd7a17c82b585093d8b9b48c1ff84c Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sat, 14 Jan 2023 21:02:22 +0800 Subject: [PATCH] Add LeaveBed command --- src/bot.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/bot.rs b/src/bot.rs index b7b9abe..b23a6c1 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -39,6 +39,7 @@ pub enum Command { Sprint, DropItem, DropStack, + LeaveBed, Script, ToggleBotStatusMessages, ToggleAlertMessages, @@ -88,6 +89,7 @@ pub async fn process_command( "sprint" => command = Command::Sprint, "drop_item" => command = Command::DropItem, "drop_stack" => command = Command::DropStack, + "leave_bed" => command = Command::LeaveBed, "script" => command = Command::Script, "toggle_alert_messages" => command = Command::ToggleAlertMessages, "toggle_bot_status_messages" => command = Command::ToggleBotStatusMessages, @@ -734,6 +736,21 @@ pub async fn process_command( ); return "I have successfully dropped 1 stack!".to_string(); } + Command::LeaveBed => { + let entity_id = client.entity_id.read().to_owned(); + log_error( + client + .write_packet(ServerboundGamePacket::PlayerCommand( + game::serverbound_player_command_packet::ServerboundPlayerCommandPacket { + id: entity_id, + action: game::serverbound_player_command_packet::Action::StopSleeping, + data: 0, + }, + )) + .await, + ); + return "I am no longer sleeping!".to_string(); + } Command::Script => { if segments.len() < 1 { return "Please give me a script file!".to_string();