generated from tipragot/rust
Implement generic online system #82
|
@ -43,7 +43,7 @@ pub fn accept_connection(
|
||||||
// Check if the player is an admin
|
// Check if the player is an admin
|
||||||
CoCo_Sol marked this conversation as resolved
Outdated
|
|||||||
if all_players
|
if all_players
|
||||||
.get_by_connection(&connection)
|
.get_by_connection(&connection)
|
||||||
.map(|player| player.is_admin())
|
.map(|player| player.rank == GameRank::Admin)
|
||||||
!= Some(true)
|
!= Some(true)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,14 +37,6 @@ impl AllPlayers {
|
||||||
/// Get the player by a connection.
|
/// Get the player by a connection.
|
||||||
pub fn get_by_connection(&self, connection: &Connection) -> Option<&Player> {
|
pub fn get_by_connection(&self, connection: &Connection) -> Option<&Player> {
|
||||||
let uuid = connection.identifier()?;
|
let uuid = connection.identifier()?;
|
||||||
|
|
||||||
self.0.get(&uuid)
|
self.0.get(&uuid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Player {
|
|
||||||
/// Create a new player.
|
|
||||||
pub fn is_admin(&self) -> bool {
|
|
||||||
self.rank == GameRank::Admin
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue
Pas compris pk il doit être admin ni qui est le joueur en question