From bfb8a9640421ab0daadb835d0cf066622c36defa Mon Sep 17 00:00:00 2001 From: VolcanicArts Date: Tue, 20 Feb 2024 20:06:48 +0000 Subject: [PATCH] Ensure the ChatBoxManager respects the blacklist setting --- VRCOSC.Game/App/AppManager.cs | 2 +- VRCOSC.Game/Managers/ChatBoxManager.cs | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/VRCOSC.Game/App/AppManager.cs b/VRCOSC.Game/App/AppManager.cs index 9d3382d6..b26a40ac 100644 --- a/VRCOSC.Game/App/AppManager.cs +++ b/VRCOSC.Game/App/AppManager.cs @@ -121,7 +121,7 @@ private void initialiseModuleManager() private void initialiseChatBoxManager() { - ChatBoxManager.Initialise(storage, this, OSCClient, configManager.GetBindable(VRCOSCSetting.ChatBoxTimeSpan)); + ChatBoxManager.Initialise(storage, this, configManager, OSCClient, configManager.GetBindable(VRCOSCSetting.ChatBoxTimeSpan)); ChatBoxManager.Load(); } diff --git a/VRCOSC.Game/Managers/ChatBoxManager.cs b/VRCOSC.Game/Managers/ChatBoxManager.cs index fd94a426..3edf80c5 100644 --- a/VRCOSC.Game/Managers/ChatBoxManager.cs +++ b/VRCOSC.Game/Managers/ChatBoxManager.cs @@ -12,6 +12,7 @@ using VRCOSC.Game.ChatBox; using VRCOSC.Game.ChatBox.Clips; using VRCOSC.Game.ChatBox.Serialisation.V1; +using VRCOSC.Game.Config; using VRCOSC.Game.OSC.VRChat; using VRCOSC.Game.Serialisation; using VRCOSC.Game.Util; @@ -41,6 +42,7 @@ public bool SendEnabled public readonly Dictionary> EventMetadata = new(); public Bindable SendDelay { get; private set; } = null!; private VRChatOscClient oscClient = null!; + private VRCOSCConfigManager configManager = null!; private SerialisationManager serialisationManager = null!; public readonly Dictionary<(string, string), string?> VariableValues = new(); @@ -61,10 +63,11 @@ public bool SendEnabled private DateTimeOffset nextValidTime; private bool isClear; - public void Initialise(Storage storage, AppManager appManager, VRChatOscClient oscClient, Bindable sendDelay) + public void Initialise(Storage storage, AppManager appManager, VRCOSCConfigManager configManager, VRChatOscClient oscClient, Bindable sendDelay) { this.appManager = appManager; this.oscClient = oscClient; + this.configManager = configManager; SendDelay = sendDelay; serialisationManager = new SerialisationManager(); serialisationManager.RegisterSerialiser(1, new TimelineSerialiser(storage, appManager)); @@ -147,15 +150,20 @@ public Clip CreateClip() public void Update() { - if (sendAllowed && !CurrentWorldExtractor.IsCurrentWorldBlacklisted) + if (!sendAllowed) return; + + if (CurrentWorldExtractor.IsCurrentWorldBlacklisted && configManager.Get(VRCOSCSetting.ChatboxWorldBlock)) { - appManager.ModuleManager.ChatBoxUpdate(); + if (!isClear) Clear(); + return; + } - Clips.ForEach(clip => clip.Update()); - TriggeredEvents.Clear(); + appManager.ModuleManager.ChatBoxUpdate(); - evaluateClips(); - } + Clips.ForEach(clip => clip.Update()); + TriggeredEvents.Clear(); + + evaluateClips(); } public void Teardown()