diff --git a/src/main/java/emu/grasscutter/game/chat/ChatSystem.java b/src/main/java/emu/grasscutter/game/chat/ChatSystem.java index b7e26b9ff..d14471ae8 100644 --- a/src/main/java/emu/grasscutter/game/chat/ChatSystem.java +++ b/src/main/java/emu/grasscutter/game/chat/ChatSystem.java @@ -51,8 +51,8 @@ public class ChatSystem implements ChatSystemHandler { * Chat history handling ********************/ private void putInHistory(int uid, int partnerId, ChatInfo info) { - this.history.computeIfAbsent(uid, HashMap::new) - .computeIfAbsent(partnerId, ArrayList::new) + this.history.computeIfAbsent(uid, x -> new HashMap<>()) + .computeIfAbsent(partnerId, x -> new ArrayList<>()) .add(info); } @@ -61,14 +61,14 @@ public class ChatSystem implements ChatSystemHandler { } public void handlePullPrivateChatReq(Player player, int partnerId) { - var chatHistory = this.history.computeIfAbsent(player.getUid(), HashMap::new) - .computeIfAbsent(partnerId, ArrayList::new); + var chatHistory = this.history.computeIfAbsent(player.getUid(), x -> new HashMap<>()) + .computeIfAbsent(partnerId, x -> new ArrayList<>()); player.sendPacket(new PacketPullPrivateChatRsp(chatHistory)); } public void handlePullRecentChatReq(Player player) { // If this user has no chat history yet, create it by sending the server welcome messages. - if (!this.history.computeIfAbsent(player.getUid(), HashMap::new).containsKey(GameConstants.SERVER_CONSOLE_UID)) { + if (!this.history.computeIfAbsent(player.getUid(), x -> new HashMap<>()).containsKey(GameConstants.SERVER_CONSOLE_UID)) { this.sendServerWelcomeMessages(player); }