forked from lavina/lavina
return AlreadyJoined when a player attempts to join a room they are already in
This commit is contained in:
parent
cebe354179
commit
5a09b743c9
|
@ -177,6 +177,7 @@ pub enum ClientCommand {
|
||||||
|
|
||||||
pub enum JoinResult {
|
pub enum JoinResult {
|
||||||
Success(RoomInfo),
|
Success(RoomInfo),
|
||||||
|
AlreadyJoined,
|
||||||
Banned,
|
Banned,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,6 +389,9 @@ impl Player {
|
||||||
if self.banned_from.contains(&room_id) {
|
if self.banned_from.contains(&room_id) {
|
||||||
return JoinResult::Banned;
|
return JoinResult::Banned;
|
||||||
}
|
}
|
||||||
|
if self.my_rooms.contains_key(&room_id) {
|
||||||
|
return JoinResult::AlreadyJoined;
|
||||||
|
}
|
||||||
|
|
||||||
let room = match self.rooms.get_or_create_room(room_id.clone()).await {
|
let room = match self.rooms.get_or_create_room(room_id.clone()).await {
|
||||||
Ok(room) => room,
|
Ok(room) => room,
|
||||||
|
|
Loading…
Reference in New Issue