Skip to content

Commit

Permalink
use HashMap::values
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowiiii committed Sep 26, 2024
1 parent 49c3641 commit 92fef82
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pumpkin/src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl World {
P: ClientPacket,
{
let current_players = self.current_players.lock();
for (_, player) in current_players.iter() {
for player in current_players.values() {
player.client.send_packet(packet);
}
}
Expand Down Expand Up @@ -261,7 +261,7 @@ impl World {

/// Gets a Player by entity id
pub fn get_player_by_entityid(&self, id: EntityId) -> Option<Arc<Player>> {
for (_, player) in self.current_players.lock().iter() {
for player in self.current_players.lock().values() {
if player.entity_id() == id {
return Some(player.clone());
}
Expand All @@ -271,7 +271,7 @@ impl World {

/// Gets a Player by name
pub fn get_player_by_name(&self, name: &str) -> Option<Arc<Player>> {
for (_, player) in self.current_players.lock().iter() {
for player in self.current_players.lock().values() {
if player.gameprofile.name == name {
return Some(player.clone());
}
Expand Down

0 comments on commit 92fef82

Please sign in to comment.