Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
CreatureChat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Public
CreatureChat
Commits
2ec4f204
Commit
2ec4f204
authored
Dec 24, 2024
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing regression when loading an old world data file, caused by a null chatMessage.name
parent
519a3aeb
Pipeline
#13204
passed with stages
in 2 minutes 21 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
EntityChatData.java
src/main/java/com/owlmaddie/chat/EntityChatData.java
+5
-2
No files found.
src/main/java/com/owlmaddie/chat/EntityChatData.java
View file @
2ec4f204
...
...
@@ -106,6 +106,9 @@ public class EntityChatData {
if
(
message
.
timestamp
==
null
)
{
message
.
timestamp
=
System
.
currentTimeMillis
();
}
if
(
message
.
name
==
null
||
message
.
name
.
isEmpty
())
{
message
.
name
=
""
;
}
}
}
blankPlayerData
.
friendship
=
this
.
legacyFriendship
;
...
...
@@ -524,8 +527,8 @@ public class EntityChatData {
// Add context-switching logic for USER messages only
if
(
sender
==
ChatDataManager
.
ChatSender
.
USER
&&
previousMessages
.
size
()
>
1
)
{
ChatMessage
lastMessage
=
previousMessages
.
get
(
previousMessages
.
size
()
-
1
);
if
(
!
lastMessage
.
name
.
equals
(
playerName
))
{
boolean
isReturningPlayer
=
previousMessages
.
stream
().
anyMatch
(
msg
->
msg
.
name
.
equals
(
playerName
));
if
(
lastMessage
.
name
==
null
||
!
lastMessage
.
name
.
equals
(
playerName
))
{
// Null-safe check
boolean
isReturningPlayer
=
previousMessages
.
stream
().
anyMatch
(
msg
->
playerName
.
equals
(
msg
.
name
));
// Avoid NPE here too
String
note
=
isReturningPlayer
?
"<returning player: "
+
playerName
+
" resumes the conversation>"
:
"<a new player has joined the conversation: "
+
playerName
+
">"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment