refactor(lua): pass set client information error

This commit is contained in:
Ryan 2025-03-17 07:19:32 -04:00
parent 3f0bfe937e
commit c0a63bd756
Signed by: ErrorNoInternet
GPG Key ID: 2486BFB7B1E6A4A3

View File

@ -6,7 +6,6 @@ use azalea::{
protocol::common::client_information::ModelCustomization, protocol::common::client_information::ModelCustomization,
}; };
use azalea_hax::AntiKnockback; use azalea_hax::AntiKnockback;
use log::error;
use mlua::{Error, Lua, Result, Table, UserDataRef}; use mlua::{Error, Lua, Result, Table, UserDataRef};
pub fn air_supply(_lua: &Lua, client: &Client) -> Result<i32> { pub fn air_supply(_lua: &Lua, client: &Client) -> Result<i32> {
@ -35,8 +34,7 @@ pub async fn set_client_information(
info: Table, info: Table,
) -> Result<()> { ) -> Result<()> {
let get_bool = |table: &Table, name| table.get(name).unwrap_or(true); let get_bool = |table: &Table, name| table.get(name).unwrap_or(true);
client
if let Err(error) = client
.set_client_information(ClientInformation { .set_client_information(ClientInformation {
allows_listing: info.get("allows_listing")?, allows_listing: info.get("allows_listing")?,
model_customization: info model_customization: info
@ -55,10 +53,7 @@ pub async fn set_client_information(
..ClientInformation::default() ..ClientInformation::default()
}) })
.await .await
{ .map_err(Error::external)
error!("failed to set client client information: {error:?}");
}
Ok(())
} }
pub fn set_component( pub fn set_component(