Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grasscutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ziqian zhang
Grasscutter
Commits
48cd9f6b
Commit
48cd9f6b
authored
2 years ago
by
AnimeGitB
Browse files
Options
Downloads
Patches
Plain Diff
Don't use UIDs as initial capacity for chat history
parent
fab7e4a4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/emu/grasscutter/game/chat/ChatSystem.java
+5
-5
5 additions, 5 deletions
src/main/java/emu/grasscutter/game/chat/ChatSystem.java
with
5 additions
and
5 deletions
src/main/java/emu/grasscutter/game/chat/ChatSystem.java
+
5
−
5
View file @
48cd9f6b
...
...
@@ -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
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment