Fix glorfcode for real (#22838)

Fix glorfcode
This commit is contained in:
Kara
2023-12-21 17:23:22 -07:00
committed by GitHub
parent 2189c6feb3
commit ee0c3c4a69
2 changed files with 12 additions and 9 deletions

View File

@@ -712,20 +712,23 @@ public sealed class ChatUIController : UIController
var msg = chatBox.ChatInput.Input.Text.TrimEnd();
// Don't send on OOC/LOOC obviously!
if (SplitInputContents(msg).chatChannel
is not (
ChatSelectChannel.Local or
ChatSelectChannel.Radio or
ChatSelectChannel.Whisper
)
)
// we need to handle selected channel
// and prefix-channel separately..
var allowedChannels = ChatSelectChannel.Local | ChatSelectChannel.Whisper;
if ((chatBox.SelectedChannel & allowedChannels) == ChatSelectChannel.None)
return;
// none can be returned from this if theres no prefix,
// so we allow it in that case (assuming the previous check will have exited already if its an invalid channel)
var prefixChannel = SplitInputContents(msg).chatChannel;
if (prefixChannel != ChatSelectChannel.None && (prefixChannel & allowedChannels) == ChatSelectChannel.None)
return;
if (_player.LocalSession?.AttachedEntity is not { } ent
|| !EntityManager.TryGetComponent<DamageForceSayComponent>(ent, out var forceSay))
return;
if (string.IsNullOrWhiteSpace(msg))
return;