refactor(player): pass gamemode as u8

This commit is contained in:
Ryan 2025-02-23 02:20:36 -05:00
parent 85cb2702f4
commit 6e75c4e586
Signed by: ErrorNoInternet
GPG Key ID: 2486BFB7B1E6A4A3

View File

@ -4,7 +4,7 @@ use mlua::{IntoLua, Lua, Result, Value};
#[derive(Clone)] #[derive(Clone)]
pub struct Player { pub struct Player {
pub display_name: Option<String>, pub display_name: Option<String>,
pub gamemode: String, pub gamemode: u8,
pub latency: i32, pub latency: i32,
pub name: String, pub name: String,
pub uuid: String, pub uuid: String,
@ -14,7 +14,7 @@ impl From<PlayerInfo> for Player {
fn from(p: PlayerInfo) -> Self { fn from(p: PlayerInfo) -> Self {
Self { Self {
display_name: p.display_name.map(|n| n.to_string()), display_name: p.display_name.map(|n| n.to_string()),
gamemode: p.gamemode.name().to_owned(), gamemode: p.gamemode.to_id(),
latency: p.latency, latency: p.latency,
name: p.profile.name, name: p.profile.name,
uuid: p.uuid.to_string(), uuid: p.uuid.to_string(),