From 98a468d3ddf06fbae62b7c8917afd5490c345e52 Mon Sep 17 00:00:00 2001 From: Smuu <18609909+Smuu@users.noreply.github.com> Date: Wed, 1 Jan 2025 13:22:02 +0100 Subject: [PATCH] feat: ignore casing when getting player by name Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com> --- pumpkin/src/world/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pumpkin/src/world/mod.rs b/pumpkin/src/world/mod.rs index 92239719..5ce6b9e7 100644 --- a/pumpkin/src/world/mod.rs +++ b/pumpkin/src/world/mod.rs @@ -604,10 +604,10 @@ impl World { None } - /// Gets a Player by username + /// Gets a Player by username (case insensitive) pub async fn get_player_by_name(&self, name: &str) -> Option> { for player in self.current_players.lock().await.values() { - if player.gameprofile.name == name { + if player.gameprofile.name.to_lowercase() == name.to_lowercase() { return Some(player.clone()); } }