hats
This commit is contained in:
@@ -5,6 +5,8 @@ pub struct Player {
|
||||
pub uuid: String,
|
||||
pub cloaks: Vec<String>,
|
||||
pub cloak: String,
|
||||
pub hats: Vec<String>,
|
||||
pub hat: String,
|
||||
}
|
||||
|
||||
pub struct Database {
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
+12
-3
@@ -5,9 +5,11 @@ pub enum Response {
|
||||
Pong,
|
||||
Success,
|
||||
Player {
|
||||
cloak: String,
|
||||
uuid: String,
|
||||
cloaks: Vec<String>,
|
||||
cloak: String,
|
||||
hats: Vec<String>,
|
||||
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("$"),
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user