diff --git a/VRCOSC.Game/Managers/ChatBoxManager.cs b/VRCOSC.Game/Managers/ChatBoxManager.cs index 3edf80c5..dc701a77 100644 --- a/VRCOSC.Game/Managers/ChatBoxManager.cs +++ b/VRCOSC.Game/Managers/ChatBoxManager.cs @@ -63,6 +63,8 @@ public bool SendEnabled private DateTimeOffset nextValidTime; private bool isClear; + private List worldBlacklistModuleBlocklist = new() { "afktrackermodule", "clockmodule", "countermodule", "exchangeratemodule", "hardwarestatsmodule", "mediamodule", "openvrstatisticsmodule", "openvrcontrollerstatisticsmodule", "tickertapemodule", "timermodule", "weathermodule" }; + public void Initialise(Storage storage, AppManager appManager, VRCOSCConfigManager configManager, VRChatOscClient oscClient, Bindable sendDelay) { this.appManager = appManager; @@ -152,12 +154,6 @@ public void Update() { if (!sendAllowed) return; - if (CurrentWorldExtractor.IsCurrentWorldBlacklisted && configManager.Get(VRCOSCSetting.ChatboxWorldBlock)) - { - if (!isClear) Clear(); - return; - } - appManager.ModuleManager.ChatBoxUpdate(); Clips.ForEach(clip => clip.Update()); @@ -199,6 +195,19 @@ public void SetTimelineLength(TimeSpan newTime) private void evaluateClips() { var validClip = getValidClip(); + + if (CurrentWorldExtractor.IsCurrentWorldBlacklisted && configManager.Get(VRCOSCSetting.ChatboxWorldBlock) && validClip is not null) + { + var blockedFromSending = validClip.AssociatedModules.Any(moduleId => worldBlacklistModuleBlocklist.Contains(moduleId)); + + if (blockedFromSending) + { + handleClip(null); + nextValidTime += TimeSpan.FromMilliseconds(SendDelay.Value); + return; + } + } + handleClip(validClip); nextValidTime += TimeSpan.FromMilliseconds(SendDelay.Value); }