Fixes #2378 where an unknown UUID was yielding null instead of "" (#2379)

This commit is contained in:
tastybento 2024-05-24 15:57:46 -07:00 committed by GitHub
parent 885d2449d9
commit ef58838c41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -158,7 +158,7 @@ public class PlayersManager {
return "";
}
return names.loadObjects().stream().filter(n -> n.getUuid().equals(playerUUID)).findFirst()
.map(Names::getUniqueId).orElse(null);
.map(Names::getUniqueId).orElse("");
}
/**

View File

@ -389,6 +389,7 @@ public class PlayersManagerTest {
assertTrue(pm.getName(null).isEmpty());
String name = pm.getName(uuid);
assertEquals("tastybento", name);
assertEquals("", pm.getName(UUID.randomUUID()));
}
/**