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
3923277aaf
commit
2a4891601d
@ -41,7 +41,7 @@ public class ChatMessageListener {
|
||||
}
|
||||
|
||||
final Collection<Player> players = CONNECTION_MANAGER.getOnlinePlayers();
|
||||
final Component expectedMessage = Objects.requireNonNullElse(player.getLastPreviewedMessage(), Component.text(message));
|
||||
final Component expectedMessage = Objects.requireNonNullElseGet(player.getLastPreviewedMessage(), () -> Component.text(message));
|
||||
PlayerChatEvent event = new PlayerChatEvent(player, players, message, packet.signature().withSigner(player.getUuid()),
|
||||
MessageSender.from(player), expectedMessage);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user