diff --git a/src/database.rs b/src/database.rs index f224267..de804ed 100644 --- a/src/database.rs +++ b/src/database.rs @@ -5,6 +5,8 @@ pub struct Player { pub uuid: String, pub cloaks: Vec, pub cloak: String, + pub hats: Vec, + pub hat: String, } pub struct Database { diff --git a/src/methods/player.rs b/src/methods/player.rs index 7e48780..359f707 100644 --- a/src/methods/player.rs +++ b/src/methods/player.rs @@ -21,6 +21,8 @@ pub fn player(session: &Session, uuid: String) -> Result { cloak: player.cloak, uuid, cloaks: player.cloaks, + hats: player.hats, + hat: player.hat, }) } @@ -28,9 +30,11 @@ pub fn create(session: &Session) -> Result { let uuid = session.local_player.id.clone(); let player = Player { - cloak: "".to_string(), - cloaks: Vec::new(), uuid: uuid.clone(), + cloaks: Vec::new(), + cloak: "".to_string(), + hats: Vec::new(), + hat: String::new(), }; session.database.players.insert_one(player.clone()).run()?; @@ -39,5 +43,7 @@ pub fn create(session: &Session) -> Result { cloak: player.cloak, uuid, cloaks: player.cloaks, + hats: player.hats, + hat: player.hat, }) } diff --git a/src/response.rs b/src/response.rs index 44dd76c..c2c4a60 100644 --- a/src/response.rs +++ b/src/response.rs @@ -5,9 +5,11 @@ pub enum Response { Pong, Success, Player { - cloak: String, uuid: String, cloaks: Vec, + cloak: String, + hats: Vec, + hat: String, }, } @@ -17,10 +19,17 @@ impl std::fmt::Display for Response { Response::Pong => write!(f, "Pong"), Response::Success => write!(f, "Success"), Response::Player { - cloak, uuid, cloaks, - } => write!(f, "@cloak={cloak}@uuid={uuid}@cloaks={}", cloaks.join("$")), + cloak, + hats, + hat, + } => write!( + f, + "@cloak={cloak}@uuid={uuid}@cloaks={}@hats={}@hat={hat}", + cloaks.join("$"), + hats.join("$"), + ), } } }