fix players find

This commit is contained in:
MeexReay 2025-05-07 19:39:12 +03:00
parent dc02f22545
commit 7f6bc59d14
2 changed files with 7 additions and 0 deletions

View File

@ -38,6 +38,7 @@ impl ServerContext {
self
.clients
.iter()
.filter(|o| o.entity_info_opt().is_some())
.find(|o| {
let info = o.player_info();
if let Some(info) = info {
@ -53,6 +54,7 @@ impl ServerContext {
self
.clients
.iter()
.filter(|o| o.entity_info_opt().is_some())
.find(|o| {
let info = o.player_info();
if let Some(info) = info {
@ -69,6 +71,7 @@ impl ServerContext {
.clients
.iter()
.filter(|o| o.player_info().is_some())
.filter(|o| o.entity_info_opt().is_some())
.map(|o| o.clone())
.collect()
}

View File

@ -107,6 +107,10 @@ impl ClientContext {
self.player_info.read().unwrap().clone()
}
pub fn entity_info_opt(self: &Arc<Self>) -> Option<Arc<EntityInfo>> {
self.entity_info.read().unwrap().clone()
}
pub fn entity_info(self: &Arc<Self>) -> Arc<EntityInfo> {
self.entity_info.read().unwrap().clone().unwrap()
}