Add LeaveBed command

This commit is contained in:
ErrorNoInternet 2023-01-14 21:02:22 +08:00
parent 1af30582d6
commit 02b2716332
Signed by untrusted user who does not match committer: ErrorNoInternet
GPG Key ID: 2486BFB7B1E6A4A3

View File

@ -39,6 +39,7 @@ pub enum Command {
Sprint, Sprint,
DropItem, DropItem,
DropStack, DropStack,
LeaveBed,
Script, Script,
ToggleBotStatusMessages, ToggleBotStatusMessages,
ToggleAlertMessages, ToggleAlertMessages,
@ -88,6 +89,7 @@ pub async fn process_command(
"sprint" => command = Command::Sprint, "sprint" => command = Command::Sprint,
"drop_item" => command = Command::DropItem, "drop_item" => command = Command::DropItem,
"drop_stack" => command = Command::DropStack, "drop_stack" => command = Command::DropStack,
"leave_bed" => command = Command::LeaveBed,
"script" => command = Command::Script, "script" => command = Command::Script,
"toggle_alert_messages" => command = Command::ToggleAlertMessages, "toggle_alert_messages" => command = Command::ToggleAlertMessages,
"toggle_bot_status_messages" => command = Command::ToggleBotStatusMessages, "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(); 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 => { Command::Script => {
if segments.len() < 1 { if segments.len() < 1 {
return "Please give me a script file!".to_string(); return "Please give me a script file!".to_string();