Skip to content

Commit

Permalink
Ensure the ChatBoxManager respects the blacklist setting
Browse files Browse the repository at this point in the history
  • Loading branch information
VolcanicArts committed Feb 20, 2024
1 parent f68528a commit bfb8a96
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion VRCOSC.Game/App/AppManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private void initialiseModuleManager()

private void initialiseChatBoxManager()
{
ChatBoxManager.Initialise(storage, this, OSCClient, configManager.GetBindable<int>(VRCOSCSetting.ChatBoxTimeSpan));
ChatBoxManager.Initialise(storage, this, configManager, OSCClient, configManager.GetBindable<int>(VRCOSCSetting.ChatBoxTimeSpan));
ChatBoxManager.Load();
}

Expand Down
22 changes: 15 additions & 7 deletions VRCOSC.Game/Managers/ChatBoxManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -41,6 +42,7 @@ public bool SendEnabled
public readonly Dictionary<string, Dictionary<string, ClipEventMetadata>> EventMetadata = new();
public Bindable<int> 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();
Expand All @@ -61,10 +63,11 @@ public bool SendEnabled
private DateTimeOffset nextValidTime;
private bool isClear;

public void Initialise(Storage storage, AppManager appManager, VRChatOscClient oscClient, Bindable<int> sendDelay)
public void Initialise(Storage storage, AppManager appManager, VRCOSCConfigManager configManager, VRChatOscClient oscClient, Bindable<int> sendDelay)
{
this.appManager = appManager;
this.oscClient = oscClient;
this.configManager = configManager;
SendDelay = sendDelay;
serialisationManager = new SerialisationManager();
serialisationManager.RegisterSerialiser(1, new TimelineSerialiser(storage, appManager));
Expand Down Expand Up @@ -147,15 +150,20 @@ public Clip CreateClip()

public void Update()
{
if (sendAllowed && !CurrentWorldExtractor.IsCurrentWorldBlacklisted)
if (!sendAllowed) return;

if (CurrentWorldExtractor.IsCurrentWorldBlacklisted && configManager.Get<bool>(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()
Expand Down

0 comments on commit bfb8a96

Please sign in to comment.