mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 06:34:16 +00:00
fix "say" command
This commit is contained in:
parent
cc30f5ba54
commit
65c27e8d99
3 changed files with 14 additions and 3 deletions
|
@ -57,7 +57,13 @@ namespace SanAndreasUnity.Chat
|
|||
|
||||
CommandManager.ProcessCommandResult ProcessSayCommand(CommandManager.ProcessCommandContext context)
|
||||
{
|
||||
ChatManager.SubmitChatMessage(CommandManager.GetRestOfTheCommand(context.command, 0));
|
||||
string msg = CommandManager.GetRestOfTheCommand(context.command, 0);
|
||||
|
||||
if (context.player != null)
|
||||
ChatManager.singleton.SubmitMessageFromPlayer(context.player, msg);
|
||||
else
|
||||
ChatManager.SendChatMessageToAllPlayersAsServer(msg);
|
||||
|
||||
return CommandManager.ProcessCommandResult.Success;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,8 +68,13 @@ namespace SanAndreasUnity.Chat
|
|||
Debug.Log(senderText + chatMessage.msg);
|
||||
}
|
||||
|
||||
internal void OnChatMessageReceivedOnServer(Player player, string msg)
|
||||
public void SubmitMessageFromPlayer(Player player, string msg)
|
||||
{
|
||||
NetStatus.ThrowIfNotOnServer();
|
||||
|
||||
if (null == player)
|
||||
throw new System.ArgumentNullException(nameof(player));
|
||||
|
||||
msg = ChatManager.ProcessIncomingChatMessage(msg);
|
||||
if (string.IsNullOrEmpty(msg))
|
||||
return;
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace SanAndreasUnity.Chat
|
|||
[Command]
|
||||
void CmdChatMsg( string msg )
|
||||
{
|
||||
F.RunExceptionSafe(() => ChatManager.singleton.OnChatMessageReceivedOnServer(m_player, msg));
|
||||
F.RunExceptionSafe(() => ChatManager.singleton.SubmitMessageFromPlayer(m_player, msg));
|
||||
}
|
||||
|
||||
internal void SendChatMsgToServer( string msg )
|
||||
|
|
Loading…
Reference in a new issue