mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-10 21:00:36 +01:00
Use else get
This commit is contained in:
parent
2a4891601d
commit
4c90af572a
@ -10,7 +10,7 @@ import java.util.Objects;
|
||||
public record MessageSender(@NotNull Component displayName, @Nullable Component teamName) {
|
||||
|
||||
public static MessageSender from(Player player) {
|
||||
return new MessageSender(Objects.requireNonNullElse(player.getDisplayName(),
|
||||
return new MessageSender(Objects.requireNonNullElseGet(player.getDisplayName(), () ->
|
||||
Component.text(player.getUsername())), player.getTeam() == null ? null :
|
||||
player.getTeam().getTeamDisplayName());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user