If a recipient can't be found for a private message sent by a client, the server sends the "player not found" error message to the client

This commit is contained in:
Regalis
2017-04-17 19:48:29 +03:00
parent 7df4bff249
commit e4a7d31f78
+18 -1
View File
@@ -1452,7 +1452,24 @@ namespace Barotrauma.Networking
if (targetClient == null)
{
AddChatMessage("Player \"" + command + "\" not found!", ChatMessageType.Error);
if (senderClient != null)
{
var chatMsg = ChatMessage.Create(
"", "Player \"" + command + "\" not found!",
ChatMessageType.Error, null);
chatMsg.NetStateID = senderClient.chatMsgQueue.Count > 0 ?
(ushort)(senderClient.chatMsgQueue.Last().NetStateID + 1) :
(ushort)(senderClient.lastRecvChatMsgID + 1);
senderClient.chatMsgQueue.Add(chatMsg);
senderClient.lastChatMsgQueueID = chatMsg.NetStateID;
}
else
{
AddChatMessage("Player \"" + command + "\" not found!", ChatMessageType.Error);
}
return;
}
}