Use sendTl to ensure message format is parsed (#5632)

Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
This commit is contained in:
MD 2024-02-04 01:47:20 +00:00 committed by GitHub
parent 04c01655f6
commit 746627c4b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -95,10 +95,10 @@ public class SimpleMessageRecipient implements IMessageRecipient {
final MessageResponse messageResponse = recipient.onReceiveMessage(this.parent, message); final MessageResponse messageResponse = recipient.onReceiveMessage(this.parent, message);
switch (messageResponse) { switch (messageResponse) {
case UNREACHABLE: case UNREACHABLE:
sendMessage(tlSender("recentlyForeverAlone", CommonPlaceholders.displayNameRecipient(recipient))); sendTl("recentlyForeverAlone", recipient.getDisplayName());
break; break;
case MESSAGES_IGNORED: case MESSAGES_IGNORED:
sendMessage(tlSender("msgIgnore", CommonPlaceholders.displayNameRecipient(recipient))); sendTl("msgIgnore", recipient.getDisplayName());
break; break;
case SENDER_IGNORED: case SENDER_IGNORED:
break; break;
@ -106,13 +106,13 @@ public class SimpleMessageRecipient implements IMessageRecipient {
case SUCCESS_BUT_AFK: case SUCCESS_BUT_AFK:
// Currently, only IUser can be afk, so we unsafely cast to get the afk message. // Currently, only IUser can be afk, so we unsafely cast to get the afk message.
if (((IUser) recipient).getAfkMessage() != null) { if (((IUser) recipient).getAfkMessage() != null) {
sendMessage(tlSender("userAFKWithMessage", CommonPlaceholders.displayNameRecipient(recipient), ((IUser) recipient).getAfkMessage())); sendTl("userAFKWithMessage", recipient.getDisplayName(), ((IUser) recipient).getAfkMessage());
} else { } else {
sendMessage(tlSender("userAFK", CommonPlaceholders.displayNameRecipient(recipient))); sendTl("userAFK", recipient.getDisplayName());
} }
// fall through // fall through
default: default:
sendMessage(tlLiteral("msgFormat", AdventureUtil.parsed(tlSender("meSender")), CommonPlaceholders.displayNameRecipient(recipient), message)); sendTl("msgFormat", AdventureUtil.parsed(tlSender("meSender")), recipient.getDisplayName(), message);
// Better Social Spy // Better Social Spy
if (ess.getSettings().isSocialSpyMessages()) { if (ess.getSettings().isSocialSpyMessages()) {
@ -170,7 +170,7 @@ public class SimpleMessageRecipient implements IMessageRecipient {
} }
} }
// Display the formatted message to this recipient. // Display the formatted message to this recipient.
sendMessage(tlLiteral("msgFormat", CommonPlaceholders.displayNameRecipient(sender), tlSender("meRecipient"), message)); sendTl("msgFormat", sender.getDisplayName(), AdventureUtil.parsed(tlSender("meRecipient")), message);
if (isLastMessageReplyRecipient) { if (isLastMessageReplyRecipient) {
// If this recipient doesn't have a reply recipient, initiate by setting the first // If this recipient doesn't have a reply recipient, initiate by setting the first